Find out the repositories permissions in gitolite

Problem

You would like to know what permission and for which repositories you have as a certain user when using gitolite to host your repositories.

Solution

Assuming that your gitolite user is gitolite and you have two different servers (server_a and server_b) with two different users (deploy_a and deploy_b) you can find out the permsissions by running the following:

$server_a/deploy_a: ssh gitolite@git_host info

$server_b/deploy_b: ssh gitolite@git_host info

Using gitolite in a non standard ssh port

Problem
You have moved your gitolite server or you want to be able to access your gitolite server behind a firewall and port 22 for ssh is no longer available.

Solution
Edit your .git/config file and replace the line with :

url = git_user_name@http://server_ip:repo_name.git

to the following:

url = ssh://git_user_name@external_ip:non_standard_ssh_port/repo_name.git

Gitweb access to gitolite repository

Problem
You are trying to set up gitolite access through gitweb but the gitweb page, shows ‘no projects avaiable’ even though you have repositories available.

Solution
Try to follow the guide here.
Some of tthe most important steps for having the right access permissions are:

  • Add the www-data user in the gitolite group by:
    $ sudo usermod -a -G gitolite www-data
  • Add the paths to the repositories and the projects list:
    $ sudo vi /etc/gitweb.conf
    $projectroot ="/var/lib/gitolite/repositories";
    $projects_list="/var/lib/gitolite/projects.list";
  • Change the permissions in the repositories:
    $ sudo chmod g+r /var/lib/gitolite/projects.list
    $ sudo chmod -R g+rx /var/lib/gitolite/repositories
  • Change permissions in the /var/lib/gitolite/.gitolite.rc file to allow access to the repositories:
    $REPO_UMASK = 0027;
  • Finally change the git-daemon to run with the gitolite group permissions in the file /etc/sv/git-daemon/run:
    exec chpst -ugitdaemon:gitolite