setting up your own git server

submited by
Style Pass
2022-09-23 15:30:28

setting a git server is easy, and involves only common shell commands, this post will show you how i started my very first self-hosted git server. find one extra computer and set up a SSH connection to it, then you are ready to start. here i used my raspiberry pi, which is always up [1].

this part is the creation of the authorized_keys, so you can SSH in with this user. basically you just add the allowed public keys here. in my case i just copied from my main user, but the ideal case is creating another key and adding that to the git server.

this is the command that creates a repo on the server, so you can push to this repo. to create it first create a folder, and then issue the init command:

you can stop here if you want, but in this state there are some anoying things on the server that can drive you nuts, for example:

first thing to improve is to remove port forwarding, so add this to the start of each entry in the ~/.ssh/authorized_keys file:

Leave a Comment