3

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

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

我将密钥文件放在文件夹中,id_rsa.pub但在尝试使用上述命令进行克隆时出现以下错误。id_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
4

2 回答 2

1

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

于 2013-07-18T14:53:49.937 回答
1

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

于 2013-07-18T14:47:44.503 回答