Dropbox is a free file synchronization/backup service where you can backup, save and share files. One of the best things is, that you can use it as git remote server.

Here is an example on how to do it. To start, open a shell/terminal window and go to your project directory:

cd ~/Projects/MyNewProject

Then enter the following lines:

git init
echo > README
git add .
git commit -m "first commit"

Go to your local Dropbox directory and create a new directory:

cd ~/Dropbox
mkdir Repositories
cd Repositories

After that create a git directory on Dropbox:

mkdir myNewProject.git
cd myNewProject.git

Then initialize a new git repository, go back to your local project and and link it to your Dropbox repository:

git init --bare
cd ~/Projects/MyNewProject
git remote add origin ~/Dropbox/Repositories/myNewProject.git
git push origin master

That’s it. From there, you can just clone ~/Dropbox/Repositories/myNewProject.git that you have associated with your Dropbox account. Of course, you can also share this repository with other Dropbox users.

  1. acatejr (2011-02-18 00:05)

    Nice article. Very useful to me. Thank you.

  2. agnoster (2011-02-18 00:34)

    I saw this idea recently, and liked it enough that I wrote a little “git dropbox” command to mirror my current repo to my dropbox. (https://github.com/agnoster/git-dropbox/)The advantage of –mirror for me is that it gets all the branches, tags and everything. For me the dropbox repo is mainly about having a complete copy of my working repo.

  3. Brian (2011-02-18 02:46)

    So what happens when two devs push to the “origin” at the same time? Will it get fixed on rebase?

  4. joe (2011-02-18 03:55)

    @agnoster: nice@Brian: I assume that one will get an error and has to wait for the other and then pull the changes.

  5. Daniel E. Renfer (2011-02-27 02:28)

    If two people push to the same branch at the same time, you’ll most likely end up with a conflict on that branch and you’ll end up with a “master” and a “master (x’s conflicted copy)” and someone will have to resolve them.One warning though… I had my dropbox on a VM that was messing up on me and for some reason it set a bunch of my files to 0 bytes. This propagated to all of my computers. Thankfully, I was able to hunt most of them down and use Dropbox’s restore option, but I still find 1 or 2 files I missed every now and then.

  6. viralpatel (2011-03-04 16:16)

    Very useful article.. I have written a similar note on using Dropbox as an SVN repository.. Have a look: http://viralpatel.net/blogs/2011/03/dropbox-svn-subversion-repository.html

  7. joe (2011-03-04 17:28)

    @Daniel Yeah you’re right. If a lot of people working on dropbox, it’s probably a better solution to come up with a real git server.@viralpatel: Thanks. Good article!

  8. [Mis herramientas] Dropbox « carlbert's Apps (2011-03-05 05:07)

    [...] 7.- Git. Para algunos proyectos he usado Dropbox para mis repositories de Git, aquí hay un articulo sencillo que explica como hacerlo: http://www.intermediaware.com/. [...]

  9. Using and learning Git | Loshin.com (2011-03-11 03:19)

    [...] How to use Dropbox as a git repository [...]

  10. Delicious Bookmarks for March 27th from 03:10 to 03:26 « Lâmôlabs (2011-03-27 16:00)

    [...] Intermediaware » How to use Dropbox as a git repository – March 27th ( tags: git dropbox howto reference versioncontrol free github hosting ) [...]

  11. [...] a One X which had a tie-in deal going with HTC Sense and Dropbox) so it was nice to stumble across this blog article today while looking around for a free way to host private git repositories [...]

  12. [...] centralizar mis repositorios de proyectos ya que tenia algunos en Github y otros hasta en DropBox (El cual no es uno perse pero se puede usar como tal..), para importar de forma facil tus repositorios desde Github a Bitbucket, luego de iniciar session [...]

  13. Zip (2013-09-23 06:40)

    From a Git beginner looking for the big picture here.. As I understand it, you are creating a project on your local drive, and cloning that up to dropbox. Then you are setting the dropbox copy as absolute master. I think I have that part.

    do I have the next stuff figured out correctly?

    Now you go to work, and use local computer A.
    –do you have to erase your old local copy of the project before you “clone ~/Dropbox/Repositories/myNewProject.git” ??

    –You do one hour of work using the local computer A copy. You want to commit a round of upgrades back to the master at dropbox. Exactly what Git commands do you use?

    git status / git diff / git add (as appropriate) and git commit will only affect the local computer A, no? How do you ‘commit’ to the dropbox master?

    git commit origin master ?? or is it git push origin master ??

    Many thanks, zip.

Add your comment now