linux - 使用 ssh 连接时 git clone 失败

标签 linux git ssh

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

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

我将 key 文件 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

最佳答案

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

关于linux - 使用 ssh 连接时 git clone 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17725125/

相关文章:

c - 第一次尝试从套接字读取失败,然后工作正常

python - 在 git 中开发整个 Zope&Plone 应用程序(去中心化且无 ZMI)

git - Hg 是否有相当于 git Revert/cherry-pick 的功能?

git - 使用SSH将Git存储库备份到S3

linux - 重用弹性 IP 时出现 AWS Instance SSH 连接问题

linux - 如何防止 SSH 中的多个连接?

linux - 就BSS、DATA、TEXT段而言,a.out文件包含什么?

php - 使用 ssh 从 github 部署到 linux 服务器但权限被拒绝(公钥)。 PHP脚本

linux - Git 自动补全看起来很奇怪(而且只有一半功能)

git - “committed”和 “unmodified”是否相同?