· 2 分钟阅读时长 · 227 字 · -阅读 -评论

title: “SSH Login to GitHub Failed” tags:

  • WebShell
  • Git slug: 6bcea92a date: 2022-10-02 17:11:34 summary: “Troubleshooting an SSH login failure to GitHub that turned out to be DNS pollution, including analysis and workarounds.”

While staying in Hubei recently, I ran into an issue accessing GitHub — SSH login kept failing even though my public key was configured correctly. It turned out to be DNS pollution. Here are the notes and fix.

Network Environment

  • China Telecom, Xianning, Hubei

Test Script

If git operations prompt for a password for git@github.com, the SSH login failed. Use the following to test SSH login status:

ssh -vT git@github.com

The logs showed public key verification failing. First suspicion: the key wasn’t configured correctly on GitHub. After confirming it was correct and the failure persisted, DNS pollution became the likely culprit.

Switching the terminal to use a proxy made the login succeed, confirming the diagnosis.

Analysis

Using dig with the default DNS server vs Google DNS (8.8.8.8) showed the default DNS returned 223.75.236.241, which is not a GitHub web address. The correct IP was 20.205.243.166; visiting it in a browser redirected correctly to GitHub.

https://static.1991421.cn/2022/2022-10-02-233445.png

Workaround

Since this was a temporary issue, I modified the hosts file and added:

20.205.243.166 github.com

Alternatively, configure your terminal to use a proxy.

Final Thoughts

Accessing GitHub/Google cleanly can be tricky at times — consider it practice in troubleshooting.

Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源