git - 即使使用 key 验证进行设置,Git仍需要密码

标签 git ssh gitolite

我在使用git时遇到问题。当我尝试访问存储库时,即使在gitserver上禁用了通过密码进行身份验证,git也会自动提示输入密码。

我的ssh配置如下(主机名/存储库已匿名):

host gitserver
  user gitolite
  hostname server.example.com
  identityfile ~/.ssh/gitolite

当我尝试克隆仓库时,由于密码请求,它失败了:
git clone gitolite@server.example.com:repository
Cloning into 'repository'...
gitolite@server.example.com's password: 

〜/ .ssh文件夹及其内容均使用here(我尝试过的许多方法之一)中所述的权限700进行设置。

有人对此有解决方案吗?

编辑:

其他克隆尝试完全相同地失败
git clone gitserver:repository
Cloning into 'repository'...
gitolite@server.example.com's password: 

编辑2:
ssh -Tv gitserver

结果如下:
debug1: Reading configuration data /home/username/.ssh/config
debug1: /home/username/.ssh/config line 1: Applying options for gitserver
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to server.example.com [1.2.3.4] port 22.
debug1: Connection established.
debug1: identity file /home/username/.ssh/gitolite type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/username/.ssh/gitolite-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4
debug1: match: OpenSSH_6.0p1 Debian-4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 00:df:a5:58:af:45:be:eb:62:65:07:5d:85:20:7c:98
debug1: Host 'server.example.com' is known and matches the RSA host key.
debug1: Found key in /home/username/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/username/.ssh/gitolite
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: /home/username/.ssh/gitolite
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
gitolite@server.example.com's password:

最佳答案

如果要使用gitolite使用的私钥,则ssh url必须为:

git clone gitserver:repository

这将使用~/.ssh/gitolite私钥,在gitolite服务器上将您标识为git。

关于git - 即使使用 key 验证进行设置,Git仍需要密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39872764/

相关文章:

git push remote : warning: hooks. 邮件列表有多个值

visual-studio-2010 - Visual Studio 2010 在 git pull 后关闭打开的文件

java - 无法将目标文件夹添加到 .gitignore

linux - 相同的 Docker 镜像在一台主机上转发 X11 但在另一台主机上不转发

C#/Tamir.SharpSsh : System. IO.IOException: 管道关闭

git - 执行更新后 Hook 后如何更改所有者?

linux - git log 不显示所有项目的任何内容

java - Play Framework 2.2 子项目

amazon-web-services - Alexa是 'Unable to Reach the Requested Skill'

git gitolite (v3) 预接收所有提交消息的钩子(Hook)