Git, Dropbox, and No SSH
So you want to use Git for your source control management system but you don’t want to use GitHub (for various reasons) and you don’t have access to a SSH (Secure Shell) accessible remote server. Or maybe you just don’t want to deal with the obstacle that SSH inevitably causes. Well luckily since Git is essentially just a bunch of text files and directories you don’t need anything more complicated than a file sharing system such as Dropbox, Box, SkyDrive, or Google Drive.
Note: From this point forward I will refer only to Dropbox for simplicity, however the same concepts work with any file sharing system.
Simply put, you can initialize a Git repository in your local Dropbox folder (either standard or bare) and then push and pull from that repository using standard network file protocol. You can then access the same repository from multiple computers by signing into your Dropbox account and synchronizing. Additionally you could share the repository either with a collaborator or a different Dropbox account.
Implementation
Here are a couple examples of how you might do this with a couple different Git clients:
Note: This post is not about how to use Git, for information about this please see the great documentation on git-scm.com. Nor does it provide instructions on how to set up and use the various file sharing services I mentioned above.
Command Line Git
For this example I am using Cygwin with Git installed. You could also do this Windows Command Prompt using the mysysgit or some other Windows distribution of Git.
- First navigate to your Dropbox directory
cd ${home}/Dropbox
- Then create a new directory which will contain your bare repository.
mkdir myProject; cd myProject
- Initialize the bare repository.
git init --bare
- Return to whatever directory you want to work from. And clone the repository from the Dropbox directory.
cd ${HOME}; git clone ${HOME}/Dropbox/myProject
TortoiseGit
TortoiseGit is a open source project aimed at integrating your SCM directly into the Windows shell (windows explorer). When installed files and directories within Git repositories will be displayed with special icons indicating their status within the repository. You will also have new context menu (right click) options specific to Git operations.
- Browse to your Dropbox directory.
- Create a new directory for your bare repository.
- Right click on the new directory and select “Create Repository Here”…
- Browse to a directory where you would like to work on your project.
- Right click and select Clone.
- Enter the path to the bare repository in your Dropbox directory.
- Done!
Pit Falls
There are several things to keep in mind with the approach.
Out of Sync Repositories
If you are working on a project with several people on the same project and you are all pushing at the same time you will very likely run into some race condition issues. Since there is going to be lag time between when you push to your remote repository and that code is then synchronized with the file share server then synchronized with all other computers sharing those files, there is a strong possibility that during that lag time someone else might have pushed some changes as well. Normally git would prevent you from pushing your changes when it sees that your code is out of date. You would first need to pull and merge your code from the remote repository then push. However, since your remote repository does not yet have the updated files it thinks everything is good to go. Boom!
That being said this is probably not a good approach for large projects with many people working on them at a fast pace.