Prevent Git Users from Logging in via SSH

  1. Change /etc/passwd from something like this:
[...]
git:x:1001:1001:,,,:/home/git:/bin/bash
[...]

to something like this:

[...]
git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
[...]

(assuming git userid is 1001 and git home is /home/git)

  1. Append to /etc/shells /usr/bin/git-shell
[...]
/usr/bin/screen
/usr/bin/git-shell
[...]