本地配置两个 github 账户,其中一个正常,一个有问题,求教?

2016-09-27 22:45:38 +08:00
 higocn
其中有问题的账户:
1. 公匙已正确添加, htts 可以访问;
2. 连接报错

···
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
···

3. ssh git@github.com -vT 测试有问题的输出:

···
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/hzchen/.ssh/config
debug1: /Users/hzchen/.ssh/config line 7: Applying options for github.com
debug1: /Users/hzchen/.ssh/config line 13: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 102: Applying options for *
debug1: Connecting to github.com [192.30.253.112] port 22.
debug1: Connection established.
debug1: identity file /Users/hzchen/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/hzchen/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
ssh_exchange_identification: Connection closed by remote host
···
2426 次点击
所在节点    git
7 条回复
Dashit
2016-09-28 09:24:05 +08:00
config 文件贴了看下。
higocn
2016-09-28 10:03:23 +08:00
@Dashit config
Host git.mydomain.com
Port 65422
HostName git.mydomain.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/aaa_rsa

Host github.com
HostName github.com
User myname
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

Host *
IdentitiesOnly yes

我发现在公司两个都可以访问,在家就只有上边那个可以访问。
Dashit
2016-09-28 10:31:39 +08:00
@higocn 我也是用这种方法弄的。看日志像是 ssh key 的问题。 wifi 情况生成的 ssh key 连网线是不能用的。没有这种情况吧。
higocn
2016-09-28 11:11:18 +08:00
@Dashit
我都是 wifi 生成的, key 应该没问题, 因为在公司网,两个都是正常访问的。只有在家里,是底下那个不能访问。
iCyMind
2016-09-28 11:12:10 +08:00
把私钥文件名改回 id_rsa 试试。
Tip: On most systems the default private keys (~/.ssh/id_rsa, ~/.ssh/id_dsa and ~/.ssh/identity) are automatically added to the SSH authentication agent. You shouldn't need to run ssh-add path/to/key unless you override the file name when you generate a key.

https://help.github.com/articles/error-permission-denied-publickey/#make-sure-you-have-a-key-that-is-being-used
higocn
2016-09-28 13:59:34 +08:00
@iCyMind 就是那个 id 的有问题, aaa 的都好着
iCyMind
2016-09-30 14:30:00 +08:00
@higocn github 那个用户名, 请改为 git

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/309397

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX