HOWTO - Git server setup on ubuntu
ref: https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
1. create 'git' user and group
$ sudo adduser git
2. create git users
$ sudo useradd -M adam # not create home directory
$ sudo passwd adam
$ sudo usermod -G git adam
$ which git-shell
in /etc/passwd, replace /bin/bash with /usr/bin/git-shell # git-only ssh login
3. handle ssh keys
$ su git
$ cd
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
$ cat /tmp/id_rsa.adam.pub >> ~/.ssh/authorized_keys
4. create new project
$ mkdir -p /home/git
$ chmod g-w /home/git # make sure group has no write access
$ cd /home/git
$ git init --bare test.git
$ chmod -R git:git test.git/ # double-check
$ chmod -R 775 test.git/
# check project from user side
$ git clone adam@serverip:/home/git/test.git
$ cd test
$ git remote -v
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home