Last Updated: October 06, 2019
·
923
· saivad

git Dropbox integration

~/project> git init

Initialize git repo in your local directory

~/project>git add .

Add all the files to staging area

~/project>git commit -m"my initial commit into the repo"

Make your first commit

~/project>cd ~/Dropbox/proj_bkp


~/Dropbox/proj_bkp>git init --bare projects.git

Creates a bare repo

~/project>git remote add origin ~/Dropbox/proj_bkp/projects.git
~/project>git push -u origin master

Thats it and your project has a remote repo on dropbox, which can be used as a backup if your primary laptop is stolen or if you dont have access to it

How to get the repo to your secondary computer

~/bkp_computer> git clone ~/Dropbox/projects/projects.git

Creates a projects dir with all your files

Make some changes and commit those changes

~/bkp_computer> touch README
~/bkp_computer> git add README
~/bkp_computer> git commit -m"adding readme" README

Push those changes to your remote repo hosted on Dropbox

~/bkp_computer> git push -u origin master

And when you have access to your primary laptop, you do a pull (which is an equivalent of svn update)

~/project> git pull origin master