Using Dropbox as GIT Backup/Repo

We wanted the ability to checkout our recent code from different locations as we are sometimes not in same geographical location. We simply needed a versioning system with repository on internet. This would have meant using one of bitbucket or github like services or setting up our own server. None of that is technically a challenge but we had been using Dropbox for sharing documents and thought to use it for GIT. This meant that we could use Dropbox for everything from code to documents to web backups.

We also wanted to take backup on NAS.  This way we get backup on 2 different locations.
We realised that best way to use Dropbox is by creating bundle of the code + assets and putting it in Dropbox folder.

We created a batch script to automate the whole system of adding new files (using gitignore of course), committing them and then creating bundle out of it to put it on Dropbox and local NAS drive. The script prompts to input commit message before committing the code.
Here is code for batch file where p drive is our NAS drive mounted on Windows.


echo "Commiting Nerdiacs Project Repo"
set INPUT=
set /P INPUT=Type input: %=%
cd e:GamesRepo
e:
call git add . -A
call git commit -m "%INPUT%"
call git bundle create E:DropboxTeamSharedCodeRepoGamesRepo.bdl master
cd p:GamesRepo
p:
call git pull origin
pause

I hope this helps others in automating bundle creation and backup on Dropbox.

Leave a Reply