【发布时间】:2011-10-08 15:02:29
【问题描述】:
此时我已经通过 gitosis 添加了一个 git repo。我使用的手册是http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
我可以克隆它并通过 ssh 身份验证将其推送到私有和公共 键(在 gentoo 上),但使用 Git 扩展的 windows 用户 不能。 SSH 密钥放在 $HOME/.ssh 中,ssh 要求输入密码。 密码和密码短语(来自私有 ssh 密钥)也不匹配。
Redmine 需要一个裸仓库,所以我从我的 gitosis 克隆了仓库 本地机器并将其移至服务器(redmine + git),然后尝试 像这里显示的一样同步 http://www.redmine.org/projects/redmine/wiki/HowTo_keep_in_sync_your_git_repository_for_redmine 但它再次要求输入密码!当然,我没有让 apache 成为他的 拥有 ssh 密钥来验证 gitosis =_=(Apache 是 redmine bare 的所有者 repo,使其通过 http auth 访问它)
无论如何,问题是如何在访问 gitosis 时使用文件中的私有 ssh 密钥?
===
部分解决!
ssh-keygen -t rsa 生成密钥,其名称正是 id_rsa 和 id_rsa.pub。
如果你运行ssh -vvv gitosis@your-server.com,你应该会看到类似于
debug1: Authentications that can continue: publickey,keyboard-interactive
…
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: user@domain-user
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /home/user/.ssh/id_rsa
debug3: no such identity: /home/user/.ssh/id_rsa
debug1: Trying private key: /home/user/.ssh/id_dsa
debug3: no such identity: /home/user/.ssh/id_dsa
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug3: no such identity: /home/user/.ssh/id_ecdsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
因此,ssh 客户端想要准确命名的文件,否则将切换到下一个身份验证方法(密码)。现在我重命名了我家用机器上的密钥,并且:
user@home ~ $ git clone ssh://git@your-gitosis-server/reponame.git
Cloning into reponame...
Enter passphrase for key '/home/user/.ssh/id_rsa':
万岁,它要求一个密码!顺便说一句,ШIИDOШS™ 用户在生成数十个密钥时仍然存在问题。
更新
如果你使用 OpenSSH,那么你可以在 ~/.ssh 中创建一个名为“config”的文件,并在其中放置如下内容:
Host mygitosisserver.com
IdentityFile ~/.ssh/private-key-for-mygitosisserver-com
【问题讨论】:
标签: git ssh gitosis gitolite git-extensions