How to prevent a user from git log over ssh?

There is OpenSSH, the address of the repository looks like this git@myserver:/home/git/project.git. Authorization keys. How to make committing could, and go to the server via ssh no.
October 8th 19 at 00:58
4 answers
October 8th 19 at 01:00
Solution
Use gitolite, it is made for such cases.
support. gitolite is and users which don't have a shell, and easily create repositories, and taxiing rights to the repository in one file. - alverta_Deckow commented on October 8th 19 at 01:03
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.
October 8th 19 at 01:04
usermod-s `which nologin` LOGIN
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
ForceCommand git_restricted
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
PermitTunnel no

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.

Find more questions by tags * nix-like systemsSSHGit