Consuelo.Lubowitz answered on October 8th 19 at 01:02
To put the users shell git-shell. Allows you to work with git, but firmly prohibits all other operations.
christophe85 answered on October 8th 19 at 01:04
usermod-s `which nologin` LOGIN
Guiseppe answered on October 8th 19 at 01:06
It is possible for these users to create a group, this group is described in the sshd config file to define the block:
Match Group gitusers
Where git_restricted, this script in your favorite language that will parse the command you tried to run, and which will be in the environment variable SSH_ORIGINAL_COMMAND, and if this is one of the relevant commands (git-receive-pack, git-upload-pack, git-upload-archive) will perform it with the correct arguments.
If you search, there are ready solutions. Although write is not a problem.