A quick way to Use Dropbox as a git repo

Algorithms For Business Resource Optimization

A quick way to Use Dropbox as a git repo

It is pretty simple, all you need to do is create the base repo in your Dropbox folder and push your code.

Create a git project

mkdir -p ~/myProject
cd ~/myProject
git init
git add .

Create and setup the Dropbox base repo

mkdir -p ~/Dropbox/Git
cd ~/Dropbox/Git
git init --bare myProject.git

Add the remote Dropbox folder

cd ~/myProject
git remote add origin ~/Dropbox/Git/myProject.git

Add a first commit

echo >> "README.md"
git add *
git commit -m "first commit"

Push the code into the remote Dropbox

git push -u origin master

gitdropbox: a script that creates a remote Dropbox repo

Here is a script that creates a new git project in ~/"new project" and initializes a git repo on your Dropbox folder (~/Dropbox/Git/"new project").

 gitdropbox myProject will do all of the above in one command.

The script is available on github.com


mkdir ~/dev

cd ~/dev

git clone https://github.com/eddinho/gitdropbox.git

sudo cp ~/dev/gitdropbox/gitdropbox /usr/local/bin/

sudo chmod +x usr/local/bin/gitdropbox

gitdropbox newProject