在Windows 7机器上设置github ssh

时间:2011-12-12 20:12:10

标签: git ssh github

我刚刚使用git's how to guide在我的Windows机器上安装了git,但是我遇到了问题。

当我运行ssh -T git@github.com步时,我收到此错误:

  

ssh_exchange_identification:读取:通过对等方重置连接

这是我通过运行ssh -vvv git@github.com获得的更长的跟踪:

OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug2: ssh_connect: needpriv 0
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /c/Users/bmehanni/.ssh/identity type -1
debug3: Not a RSA1 key file /c/Users/bmehanni/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /c/Users/bmehanni/.ssh/id_rsa type 1
debug1: identity file /c/Users/bmehanni/.ssh/id_dsa type -1
ssh_exchange_identification: read: Connection reset by peer

由于

3 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,但从未找到解决问题的方法。

解决方法是使用https而不是ssh。

答案 1 :(得分:2)

似乎你的id_rsa密钥类型错误

debug2: key_type_from_name: unknown key type

ssh正在尝试从密钥文件名中推断出类型。生成密钥时,需要使用-t rsa标志指定类型。

ssh-keygen -t rsa

此外,接受私钥id_rsa的文件名和公钥id_rsa.pub的默认值,否则您需要在~/.ssh/config文件中添加github的配置用于该特定主机的私钥。

Host github.com
    HostName github.com
    User git
    IdentityFile C:/Users/youruser/.ssh/someotherkeyname

答案 2 :(得分:0)

看起来你的ssh密钥有问题,所以我猜你在运行ssh-keygen时出了什么问题。尝试重新运行该步骤