chown -R git:git test.git
- specify
git-shell instead of bash for git login shell
cat /etc/shells # see if `git-shell` is already in there. If not...
which git-shell # make sure git-shell is installed on your system.
sudo vim /etc/shells # and add the path to git-shell from last command
sudo chsh git # and enter the path to git-shell, usually: /usr/bin/git-shell
- Create the user, replacing
example_user with your desired username, and assign a password:
useradd example_user && passwd example_user
- Add the user to the
wheel group for sudo privileges:
usermod -aG wheel example_user
- Upload the public key to your server:
ssh-copy-id example_user@255.255.255.255
- SSH daemon options:
PermitRootLogin no
PasswordAuthentication no
- Restart the SSH service to load the new configuration.
sudo systemctl restart sshd
如何在 Linux 上搭建一个 Git 中央仓库
gitosis
How to Secure Your Server
Git on the Server - Setting Up the Server