Gitolite git clone 需要ssh密码

标签 git ssh github gitolite

在 Ubuntu 服务器上使用 Gitolite。我正在处理一个项目,我需要 git 命令的特定语法。

效果很好:

git clone gitolite@servername:testing.git

要求输入密码

git clone ssh://gitolite@servername/home/gitolite/repositories/testing.git

从同一个盒子里跑出来,一个接一个。我可以输入密码并且它有效。但我需要自动工作。听起来像是 ssh pub/private key 的问题。有什么想法吗?

更新:文件权限有问题。不确定 too 命令之间的区别。但是 /var/log/auth.log 显示了一些错误

最佳答案

你需要设置 ~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

编辑:反射(reflect)您将“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
....

关于Gitolite git clone 需要ssh密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12467293/

相关文章:

security - 本地虚拟机更改了 ssh 指纹

git - 在 git 中使用历史记录恢复已删除的文件

linux - 致命的 : bad config file line 1 in/home/trx/. gitconfig

linux - bash脚本的奇怪行为

python - 通过 SSH 在远程服务器上运行 Python 脚本

java - 如何使用 maven/travis 将二进制文件打包、压缩并部署为 zip/tar.gz 从 github 存储库到 bintray.com 通用存储库

cocoa - 将 Sparkle Updater 与托管在 GitHub 上的下载一起使用

git - 删除 git 子模块的问题

git - git push 到远程后目标目录为空

Git 注释细节