Solo Repo (use a Normal git repo)
For most projects, I do not need to merge changes with multiple people, but I want a version history. For these, I set up a normal git repository. This repo has no "origin", so I never push to anything, just stage and checkin.
cd ~/Dropbox/myproject git init git add . git commit -m 'first commit' # after a while git status git commit -a -m 'another commit'
Easy to do, and all my changes (even when I don't happen to check them in) follow me on all the computers I use dropbox on.
Shared Repo (use a Bare git repo)
In this case, I'll make a bare git repo and then share the folder with others. I'll assume I'm starting with an existing project directory, but it is not a git repo yet. (there are other ways to do this).
# my project is sitting on my local machine somewhere. # I will make it a normal git repository cd someproject git init git add . git commit -m 'first commit' # now make a bare git repository on my dopbox folder # by convention, bare repos end in '.git' mkdir -p ~/Dropbox/git/someproject.git pushd ~/Dropbox/git/someproject.git git init --bare popd # back where I was git remote add origin ~/Dropbox/git/someproject.git # now we can push and pull to our origin (see below if you get errors) git pull git push
If you get trouble when pushing or pulling to your remote, add these lines to your ~/.gitconfig file:
[push] default = matching [branch "master"] remote = origin merge = refs/heads/master