A Quick Way to Use Dropbox as a Git Repo

OPT+ALGO
1 min readJan 1, 2020

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

Usage

mkdir ~/dev cd ~/devgit clone https://github.com/eddinho/gitdropbox.git sudo cp ~/dev/gitdropbox/gitdropbox /usr/local/bin/sudo chmod +x usr/local/bin/gitdropbox gitdropbox newProject

Originally published at http://optalgo.com on January 1, 2020.

--

--

OPT+ALGO

Operations Research, Decision Aid and Optimization