I set up a remote Git repository on a shared host account I own. To allow another developer to push/pull, I added his public key (id_rsa.pub) to 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 he cannot do anything else on my shared host but access git, so I added this to the beginning of his 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, it responds on the command-line with "fatal: protocol error: bad line length character".
I've searched with Google, and found others having this problem, but could not find an adequate answer as to how to solve this without allowing this other user to have access to a shell on my shared host account.
You need to limit the other developer's key to running
git-shell
as inCheck if you have a local command in your
~/.ssh/config
such asIf you do, make sure you don't execute that command when using git servers. You can do it by overriding the
LocalCommand
just for the desired hosts: