【问题标题】:git clone fails when uses ssh connection使用 ssh 连接时 git clone 失败
【发布时间】:2013-07-18 13:41:01
【问题描述】:

我使用以下命令克隆了一个 git 存储库

git clone ssh://git@test.server.com/project.git

我将密钥文件id_rsa.pubid_rsa 放在文件夹~/.ssh/ 中,但尝试使用上述git 命令进行克隆时出现以下错误。

ssh -v git@test.server.com
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /home/user/.ssh/config
debug1: Applying options for test.server.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to test.server.com [x.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa.pub 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/user/.ssh/id_rsa.pub-cert type -1
ssh_exchange_identification: Connection closed by remote host

【问题讨论】:

  • 你能告诉我们你已经尝试过什么...快速duckduckgo :) 把我带到这里:http://edoceo.com/notabene/ssh-exchange-identification
  • 为什么直接使用ssh:git clone user@server:~/repos/project.git

标签: linux git ssh


【解决方案1】:

您必须在/home/git/.ssh/authorized_keys 的服务器上添加本地密钥(在/home/user/.ssh/id_rsa.pub 中找到)

【讨论】:

    【解决方案2】:

    您可以使用ssh-copy-id 将您的公钥发送到服务器。

    【讨论】:

      猜你喜欢
      • 2018-08-29
      • 2022-01-22
      • 1970-01-01
      • 2013-07-18
      • 2019-08-16
      • 1970-01-01
      • 2018-10-19
      • 2020-04-18
      • 1970-01-01
      相关资源
      最近更新 更多