Last active
February 8, 2018 20:50
-
-
Save yuezhu/2ab041f95b3d2d8022b49312a7a0c635 to your computer and use it in GitHub Desktop.
Setup SSH GIT server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo useradd --create-home --skel /dev/null --home-dir /repo --shell /usr/bin/git-shell git | |
sudo chmod 750 /repo | |
sudo mkdir -p /repo/.ssh | |
sudo cp ~/.ssh/authorized_keys /repo/.ssh/ # Use current user's authorized_keys | |
sudo chown -R git:git /repo/.ssh/ | |
sudo mkdir -p /repo/git-shell-commands | |
sudo sh -c "cat >/repo/git-shell-commands/no-interactive-login <<\EOF | |
#!/bin/sh | |
printf '%s\n' \"No interactive shell access is provided by this GIT server.\" | |
exit 128 | |
EOF" | |
sudo chmod +x /repo/git-shell-commands/no-interactive-login | |
sudo chown -R git:git /repo/git-shell-commands |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment