DEV Community

Nick | OneThingWell.dev
Nick | OneThingWell.dev

Posted on • Edited on • Originally published at onethingwell.dev

Consider hosting your own git repositories

In the light of the recent events, a lot of people are searching for alternatives to GitHub.

Hosting your own git repos is not as hard as people may imagine and maybe you should consider that as an option.

It boils down to this:

  1. If you don't already have a Linux/BSD VPS, consider getting one (it'll be useful for a lot more than this)

  2. Make sure that you have git installed (i.e. apt/yum install git)

  3. Make a directory and do git --bare init there

Congrats - you can now easily access your new repo over ssh:

git clone ssh://myhost/mydir
Enter fullscreen mode Exit fullscreen mode

It may be also worth mentioning that now you have full access to things like git hooks (from which you have direct access to your whole system - this can be pretty useful).

Next steps

For private repos, you don't need much more than this.

Making your repositories publically available is also not hard - there are many ways, the simplest one is probably to just pass HTTP requests from your web server (e.g. nginx) to git-http-backend (I'll create a separate post for this).

Note: If you're new to all this, you may want to experiment in local VMs before you're comfortable with managing a real VPS.

Top comments (0)