Set up self-hosted git via Dropbox sync

For this part, it is assumed that you have basic knowledge about git and have already worked with it in the past.

If you don't yet have git installed, here is a good guide: How to install git.

As mentioned in the title above, I like to run git locally without initially using github, gitlab, or bitbucket in the cloud. The main reason is that I usually work alone on projects anyways, most of the projects lead nowhere, and with a Dropbox sync I can get to the same results as any of the cloud services without the overhead. And I can at any point in time still migrate it to the cloud, so there is no real downside for me.

To get started, first initialize git in your project directory NEW_STATIC_WEBSITE:

$ git init
$ git add -A
$ git commit -m "Initialize repository"

Then, create a git folder for all your projects in your Dropbox (or similar) and create the git destination to sync to:

$ cd ~/Dropbox
$ mkdir git
$ cd git
$ git init --bare NEW_STATIC_WEBSITE.git

(If you already have a git folder in your Dropbox, skip the mkdir git part)

You're almost done, now you only need to set the new git file in your Dropbox as the remote to "git push" to. Start by going back to the project NEW_STATIC_WEBSITE directory:

$ cd ~/NEW_STATIC_WEBSITE
$ git remote add origin ~/Dropbox/git/NEW_STATIC_WEBSITE.git
$ git push -u origin master

Lastly, not too font of the antiquated master branch, I set up production and development branches:

$ gco -b production
$ git push --set-upstream origin production
$ gco -b develop
$ git push --set-upstream origin develop

And you're all set up to use git normally with git add -A , git commit -m"message" , and git push — going directly into your Dropbox.

comments powered by Disqus