求助,github 已经配置好 ssh,但是提示输入密码

2022-09-21 16:38:21 +08:00
 luvxy

之前用的好好的,包括我其他 git 平台 ssh 都是正常使用,只有 github 不行. 尝试删除.ssh 里所有文件 重新生成 ssh key,重新上传 github 还是不行,其他 git 平台上传后就正常使用了 现在是我自己 github 仓库代码都没拉取了. 执行

ssh -vT git@github.com

结果

ssh -vT git@github.com
OpenSSH_8.6p1, LibreSSL 3.3.5
debug1: Reading configuration data /Users/dzjhack/.ssh/config
debug1: /Users/dzjhack/.ssh/config line 1: Applying options for *
/Users/dzjhack/.ssh/config line 4: Unsupported option "rsaauthentication"
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to github.com port 22.
debug1: Connection established.
debug1: identity file /Users/dzjhack/.ssh/id_rsa type 0
debug1: identity file /Users/dzjhack/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6
debug1: compat_banner: match: OpenSSH_7.6 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to github.com:22 as 'git'
debug1: load_hostkeys: fopen /Users/dzjhack/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M+vup8R0
debug1: load_hostkeys: fopen /Users/dzjhack/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/dzjhack/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/dzjhack/.ssh/id_rsa RSA SHA256:s/fI1dGa0oTc+khA0wJkPDSqJ5zOjQgBfmeP2DObn3Y explicit agent
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/dzjhack/.ssh/id_rsa RSA SHA256:s/fI1dGa0oTc+khA0wJkPDSqJ5zOjQgBfmeP2DObn3Y explicit agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
git@github.com's password:
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
git@github.com's password:
2190 次点击
所在节点    git
17 条回复
luvxy
2022-09-21 16:39:20 +08:00
最后要我输入密码 怎么输入都是报 Permission denied, please try again.
haolongsun
2022-09-21 16:58:07 +08:00
github 有自己的 cli 验证,https://cli.github.com/ ,建议用这个验证。
EZ4ZZW
2022-09-21 17:10:54 +08:00
我猜是 macOS Monterey Beta 版出现的问题🤔要是临时用的话可以 git remote add https ______https__repo__url 然后直接 git push https 上传,目前还没解决这个问题
luvxy
2022-09-21 17:20:38 +08:00
@EZ4ZZW 不是这个问题, 我执行的是 ssh -vT git@github.com 。还没有去拉仓库代码 ,不过这两方式结果一样
EZ4ZZW
2022-09-21 17:49:13 +08:00
@luvxy 我刚才找到了一个解决方案,把 ssh 改成 ssh over https ,可以解决这个问题,但是还没发现实质问题在哪里。https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port
jinqzzz
2022-09-21 17:51:42 +08:00
你试试解决一开始的报错

debug1: Reading configuration data /Users/dzjhack/.ssh/config
debug1: /Users/dzjhack/.ssh/config line 1: Applying options for *
/Users/dzjhack/.ssh/config line 4: Unsupported option "rsaauthentication"
Pythondr
2022-09-21 17:56:26 +08:00
luvxy
2022-09-21 18:08:41 +08:00
解决了 host 里面配上 140.82.114.4 github.com
IvanLi127
2022-09-21 18:09:47 +08:00
[GitHub's SSH key fingerprints - GitHub Docs]( https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints)

我草率地看了下,大概是因为你连到的服务器不是 GIthub 的。可能被劫持了。

我用你执行的命令试了下,其中这行你的和我的不一样:

```
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
```

建议重新生成一次密钥对。。。然后执行:

```
ssh-keygen -R github.com
```

看清楚服务器指纹是否正确,正确了同意连接。
thefck
2022-09-21 18:11:37 +08:00
> Server host key: ssh-rsa SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M+vup8R0
和我昨天遇到的情况一模一样,连这个都一样。
改了下 github 的 hosts 就可以了。
湖北?今天在 v2 看到说湖北电信 github 的 dns 被污染了,不知道是否有关系
luvxy
2022-09-21 18:12:59 +08:00
@thefck 是湖北电信。我擦 我也就是改 hosts 好了
hxy100
2022-09-21 18:17:37 +08:00
国内运营商连 Github 都要污染吗?本人 Github 相关域名常年走软路由,居然没有发现问题~
ncepuzs
2022-09-21 18:22:12 +08:00
~/.ssh/config Windows 下

Host github.com
HostName ssh.github.com
Port 443
User git
ProxyCommand connect -S 127.0.0.1:1080 -a none %h %p

Host *
IdentityFile "C:\Users\<user>\.ssh\id_rsa"
ServerAliveInterval 30
TCPKeepAlive yes
ganymede
2022-09-24 15:33:38 +08:00
湖北移动也碰到这个问题了,用了楼主该 hosts 方式解决了
HuangLibo
2022-10-05 17:26:51 +08:00
湖北联通也遇到了这个问题,我是通过把默认 DNS 改成 114DNS 解决的。楼上说的改 host 应该也是可以的,一样的原理,DNS 被运营商劫持了。
Zhuxb
2022-10-11 10:21:03 +08:00
我也是湖北电信,昨天折腾了俩小时,真蛋疼
asanelder
2023-01-17 22:31:08 +08:00
同湖北电信, 俺最近几天也遇到这个问题了

SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M+vup8R0 这个 fingerprint 有问题, 不属于 https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints 中列举的.
应该是 dns 污染了
修改 host 的方法好使

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

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

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

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

© 2021 V2EX