User Tools

Site Tools


development:vc:gitsrv

This is an old revision of the document!


Git Server

Did setup a Git server on (MX) Linux, which can be used via SSH as user “git”.

  1. install packages git and openssh;
  2. create a system user “git”:
    sudo adduser --system --home /home/git --shell /usr/bin/git-shell --group git
  3. change into it's home directory and run a shell as user “git” (cd /home/git && sudo -u git bash);
  4. setup SSH directory:
    mkdir .ssh && chmod 0700 .ssh
    touch .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys
  5. append public key of each potential client somehow to .ssh/authorized_keys, for example by:
    cat /from/somehow/id_rsa.pub >> .ssh/authorized_keys
  6. (optional) provide a shell script ~/git-shell-commands/no-interactive-login for testing authentication (test from extern with: ssh git@gitsrv or ssh git);

Finally init an “example” project (as user “git”, see above)

mkdir ~/example.git
git init --bare ~/example.git

and push something in, may be a bare “example” repository located on another network host:

git clone --mirror file:///home/repos/example example.git
cd example.git
git push --mirror git@gitsrv:example.git
development/vc/gitsrv.1789584502.txt.gz · Last modified: by Ralf Hoppe