Consider hosting your own git repositories

📄 OneThingWell.dev wiki page | 🕑 Last updated: Jul 8, 2022

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

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.


Ask me anything / Suggestions

If you have any suggestions or questions (related to this or any other topic), feel free to contact me. ℹī¸


If you find this site useful in any way, please consider supporting it.