Git push returns "fatal: protocol error: invalid string length character"

I installed the remote Git repository on the shared host account that I own. To allow another developer to push / pull, I added my public key (id_rsa.pub) at the end of .ssh / authorized_keys on the shared host. Then he was able to do "git push". But I want to make sure that it can not do anything on my shared host, but access to git, so I added this at the beginning of my entry in authorized_keys, according to man authorized_keys :

command="/usr/bin/git",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa ...

Now, when he does git-push, he answers the command line "fatal: protocol error: bad length length character".

I searched on Google and found that others have this problem, but could not find an adequate answer to the question of how to solve this problem, not allowing this other user to have access to the shell on my shared host account.

+1
source share
2 answers

You need to restrict another developer key to run git-shell, as in

command = "/ usr / bin / git-shell -c \" $ {SSH_ORIGINAL_COMMAND: -} \ "", no-port -...
+3
source

Check if you have a local command in ~/.ssh/confige.g.

Host *
    LocalCommand echo 'Connected as "'%r'" to "'%h'"' ; echo 'SSH host "'%n'"'

, , git. , LocalCommand :

Host *github*
    LocalCommand ''

Host *
    LocalCommand echo 'Connected as "'%r'" to "'%h'"' ; echo 'SSH host "'%n'"'
0

Source: https://habr.com/ru/post/1754162/


All Articles