Time to move my personal git repositories onto my VPS.
To this end I installed and configured gitolite3 and gitweb on Debian 9.
The gitolite install is simply “apt-get install gitolite3”, and specify an ssh public key as the admin key. I then tweaked it as follows:
- renamed the gitolite3 user to git (by directly editing /etc/passwd etc.)
- changed UMASK to 027 (for gitweb)
- enabled the ‘create’, ‘fork’, ‘readme’, and ‘D’ commands
- enabled the ‘no-auto-create’ setting
- Changed permissions in
chmod g+rX repositories
chmod g+rX repositories/*
chmod g+r projects.list
I then cloned the gitolite-admin repository and added my users and groups.
To set up access for gitweb, I added the following special rule which exposes all repositories to gitweb as well as a rule to hide any secret repositories (simply add them to the @secret group)
repo @all R = daemon gitweb repo @secret - = daemon gitweb option deny-rules = 1
The only issue I had was trying to track down how to prevent wild repositories being created on every clone request. No amount of searching gave me an answer, but it helps to read the comments in the configuration files..
The gitweb install was similarly painless; “apt-get install gitweb” and then :
- add www-data user to the git group
- adduser www-data git
- $projectroot = “/var/lib/gitolite3/repositories”;
- $projects_list = “/var/lib/gitolite3/projects.list”;
- $export_ok = “git-daemon-export-ok”;
I also set up some the site name and extra breadcrumbs and a home-link for nicer navigation back to the system homepage.
I left the default Debian integration with apache, which adds a ‘/gitweb’ endpoint. I also had a vhost configuration but didn’t use it.
Import / migrate old repositories
Finally time to migrate my old gitolite2 repositories, which was a bit more involved as I no longer have the gitolite2 server running.
Luckily there’s a good set of step-by-step instructions on the gitolite homepage.
Basically, copy the bare repository into <code>/var/lib/gitolite3/repositories</code>, ensure the permissions are correct, run <code>gitolite setup</code> to fix the git state, and finally add any normal repositories to your gitolite-admin configuration.
Copy the repositories into <code>/var/lib/gitolite3/repositories</code> and manually add them to the gitolite configuration.
Copy them into the repositories directory ensuring they are in the correct place based on your configuration, then add a ‘gl-creator’ file which has to consist of the name of the user which created the repository.
In my case there was already a ‘gl-creater’ file in each repo, so I simply renamed them to ‘gl-creator’:
find . -name "gl-creater" -execdir mv gl-creater gl-creator \;