【问题标题】:github ssh connection setupgithub ssh 连接设置
【发布时间】:2015-12-17 11:45:26
【问题描述】:

我的权限被拒绝(公钥)。在 Windows 7 x64 上

我做的是:

1) 也更新了我的 git + openSSH

2) 使用 ssh-keygen -t rsa -b 4096 -C "myemail@gmailcom" 生成密钥

3) 将它们命名为“hub”,所以我在 .ssh 文件夹中有 hub + hub.pub

4) 运行 ssh-agent -s

5) 运行 ssh-agent sh -c 'ssh-add ./hub' 它说添加了身份,我无法在 Windows 上运行“eval $(ssh-agent -s)”,所以我找到了“sh -c”(顺便说一句,为什么每个人总是只写类似 unix 的指令()

6) 将我的公钥添加到我的 github 帐户中的 github SSH 密钥列表中

7) ssh -vT git@github.com

完整日志:

C:\Users\ra\.ssh>ssh -vT git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to github.com [192.30.252.131] port 22.
debug1: Connection established.
debug1: identity file /.ssh/identity type -1
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-sha1 none
debug1: kex: client->server aes128-cbc hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/identity
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

为什么我应该做其他事情?

【问题讨论】:

    标签: github ssh


    【解决方案1】:
    debug1: Trying private key: /.ssh/identity
    debug1: Trying private key: /.ssh/id_rsa
    debug1: Trying private key: /.ssh/id_dsa
    

    您正在尝试使用这些文件中的(错误?)密钥进行连接。
    那么this可以帮助你吗?
    我确定在 Windows 上有这样的配置文件吗?

    【讨论】:

    • 复制了 id_rsa 名称的密钥,结果相同。 .ssh 文件夹中没有任何配置文件。
    • 不,不在您的 .ssh 文件夹中。只有你的 ssh 密钥。在 windows 上从 github 搜索配置文件。并再次将 id_rsa 文件添加到 ssh-agent 中?
    • 是的,已经添加了 id_rsa usina sh -c 'ssh-add id_rsa',好的,谢谢会找到配置。
    【解决方案2】:

    最终我发现,我的电脑上安装了几个 GIT。一个在 Program Files 中,另一个在 Program Files x64(旧版本)中。似乎在安装过程中没有完全删除旧版本或更新版本。

    在我卸载了两者并安装了新的之后,它工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-30
      • 2011-07-24
      • 2012-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      相关资源
      最近更新 更多