The Poor Mans git hosting

This is a quick tip for all developers out there that want free private git hosting. You will need Dropbox (Referral link) or Google Drive. For the purpose of this example, we will use Dropbox.

Step 1

Initialize git in your project and we will add and commit all your files.

~/ $ cd your-project
~/your-project $ git init
~/your-project $ git add .
~/your-project $ git commit -m "first commit"

Step 2

Change directory to dropbox. Create a directory named git if you don’t have one already:

~/your-project $ cd ~/Dropbox/
~/Dropbox/ $ mkdir git
~/Dropbox/ $ cd git

Step 3

Initialize a bare git named your-project.git and change directory back to your project.

~/Dropbox/git $ git init --bare your-project.git
~/Dropbox/git $ cd ~/your-project

Step 4

Add the drop remote to your project. Instead of using the standard remote name of origin, use dropbox. This way it ensures if you ever want to add a second remote location, you can still name it origin.

~/your-project $ git remote add dropbox ~/Dropbox/git/your-project.git
~/your-project $ git push -u dropbox master

Once the remote is set, we push the previously committed changes. And that is all, now your git repo will be in the cloud as a backup and for free.

For Google Drive, the steps to follow are the same, except of using the Dropbox folder, you will use the Google Drive folder. The Google Drive sync app needs to be installed and downloaded.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s