您需要使用类似的行设置 ~gitolite/.ssh/authorized_keys
command="/home/gitolite/bin/gl-auth-command <USERNAME>",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAA...KEY.HERE...ZZZZ== user@label
包含与此相关信息的随机 URL(请参阅页面底部)
http://www.geekgumbo.com/2011/10/18/ssh-and-the-gitolite-installation-part-2/
确保根据 SSH 要求更改 ~gitolite/.ssh/authorized_keys 的所有权:
chown gitolite: ~gitolite/.ssh/authorized_keys
chmod go-w ~gitolite/.ssh/authorized_keys
编辑:反映您将“git”更改为“gitolite”系统用户名的编辑。
使用以下命令测试您从客户端的访问:
ssh -l gitolite -i <file_id_rsa_foobar> -v -o PasswordAuthentication=no -T <host>
在我的本地系统上添加 -T 似乎需要获取横幅(输入借口错误):
....
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/username/.ssh/id_rsa_foobar
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering DSA public key: /home/username/.ssh/id_dsa_foobar
debug1: Remote: Forced command: /home/gitolite/bin/gl-auth/command <username>
....
hello <username> this is gitolite vX.X.XX-g0123abcd running on git X.X.X
the gitolite config gives you the following access:
R W mydir/project1
....