Hosting a git server
Between my work for Profound and my personal projects, the list of git repositories I have to manage has grown quite large over time. Because of this, I chose to host my own git server. It was by far the cheapest option, but also the one that didn’t have me relying on a 3rd party to host my company’s source code. Surprisingly though, it was also the option that turned out the most convenient to manage.
In this post I will walk you through how to setup your own “gitolite” server and start hosting your own git repositories. To get started, make sure you have git installed on your server:
Then create a user, that will run gitolite later.
In order to provide easy access to gitolite on the remote machine, we need to create a key-pair. This will give your local machine access to the gitolite-admin repository, which is used for your git server’s configuration.
As the newly created user, install gitolite.
That’s it, we’re up and running. Right now the only workstation with access, is the one that the gitadmin.pub came from. In order to add users and new repositories, we’ll have to checkout the gitolite-admin repository.
Adding keys for user authentication:
The folder “keydir” is where user’s keys are stored. Currently, you will see a gitolite.pub file in there. That is the “gitolite” user we use to administrate our gitolite installation. You can create a new user called “jens” by copying that person’s public key into the “keydir” directory, naming the key “jens.pub” and then committing it to the repo.
Adding Users, Usergroups and new Repos:
To manage your git server, simply edit the file gitolite-admin/conf/gitolite.conf in the repository on your local machine. Any changes made in there that are committed back to your gitolite server are automatically applied.
I hope that gives you a good overview of how to host your own git server. If you found this helpful, please subscribe to this blog or follow my company at @weareprofound.