我使用以下命令克隆了一个 git 存储库
git clone ssh://git@test.server.com/project.git
我将 key 文件 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
最佳答案
您必须在服务器上的 /home/user/.ssh/id_rsa.pub
中添加您的本地 key (在 /home/git/.ssh/authorized_keys
中找到)
关于linux - 使用 ssh 连接时 git clone 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17725125/