Code, Computers & Random Junk

Git Private Repositories With Dropbox

Since GitHub doesn’t offer private repositories on the free plan. One way to get that is to make use of Dropbox. In that way you can share a folder with your friend/colleauge and use it for your private repository.

It’s not that complicated to get started. octocat


In your Dropbox folder - add a folder where to keep your private repos.

mkdir ~/Dropbox/_Git && cd ~/Dropbox/_Git

To make a remote bare origin repository.

git init --bare fooProject.git

Local repository

I have all my (own) repo’s in my home folder: ~/Repos. So let’s make a subfolder where to keep the private ones.

mkdir ~/Repos/_PrivateRepos && cd ~/Repos/_PrivateRepos

To create the project.

mkdir fooProject && cd fooProject
git init

In case you want or need to specify another name/user rather than your default one in ~/.gitconfig.

git config "FirstName LastName"
git config ""

To be able to push it we’ll have to add a remote origin, which is the one you just made in Dropbox.

git remote add origin ~/Dropbox/_Git/fooProject.git

Let’s add a file:

echo -e 'Project Name\n------------\n\nWelcome to our project.' >
git add .
git commit -m "Initial commit"

Once you’re done with adding and commiting your file(s).

git push origin master


Since we don’t use a web interface we don’t get to see the “description”, but if you do want to add/change. It’s easily made with an(y) editor. Like nano, vim etc.

nano ~/Dropbox/_Git/fooProject.git/description

Perhaps you want to add a .gitignore file to your repo to match project specific excludes. Example:

# Skip these

# ...and notes


Now you can use you private repository either on your own with the Dropbox folder as a remote backup, or share your remote with your friend/colleauge. You both will have a local remote repository and Dropbox will keep it synced.

Happy hacking…