Created: 2008-06-15 19:12
Updated: 2018-03-07 18:33
License: gpl-2.0


git-ssh is a proxy to serve git repositories over ssh.


git-ssh can force your ssh server to handle only git requests. You can allow your users to pull or push, but not to login or to do scp or sftp.


  • No other account creation to handle a new commiter.
  • Can chroot to a directory to limit access of the repository server.

Later :

  • Can allow read, write or none access to a repository on a user basis.


Create a git user account

# groupadd git
# useradd -g git -h /var/git -m git
# passwd

You need to put a strong password that you can immediately forget.

Prepare for ssh keys

# mkdir ~git/.ssh
# touch ~git/.ssh/authorized_keys
# chown -R git:git ~git/.ssh
# chmod 700 ~git/.ssh

When you have to add a key in the ~git/.ssh/authorized_keys, simply add at the beginning of the line :

command="/usr/bin/git-ssh -r /var/git lemarsu"

For example:

command="/usr/bin/git-ssh -r /var/git lemarsu" ssh-dss [...] lemarsu@zorglub

The -r option ask git-ssh to chroot the folder /var/git. This way, the users cannot get away from the directory of repositories.


LeMarsu <ch dot ruelle at lemarsu dot com>


See file COPYING.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more