My local computer is using win10, gitbash client, before the local repository and github remote repository can communicate normally via ssh in both directions(pull/clone or push etc), but this time when I pull the remote code to update locally, I get an error.
git pull origin main
Connection reset by 140.82.112.4 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I then tried the following command to see if it worked.
ssh -vT [email protected] -A
OpenSSH_8.3p1, OpenSSL 1.1.1g 21 Apr 2020
debug1: Reading configuration data /c/Users/Administrator/.ssh/config
debug1: /c/Users/Administrator/.ssh/config line 2: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [140.82.112.4] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Administrator/.ssh/id_rsa type 0
debug1: identity file /c/Users/Administrator/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3
debug1: Remote protocol version 2.0, remote software version babeld-25270101
debug1: no match: babeld-25270101
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
Connection reset by 140.82.112.4 port 22
It was also tested using the following command.
ping github.com
正在 Ping github.com [140.82.112.4] 具有 32 字节的数据:
来自 140.82.112.4 的回复: 字节=32 时间=222ms TTL=44
来自 140.82.112.4 的回复: 字节=32 时间=222ms TTL=44
来自 140.82.112.4 的回复: 字节=32 时间=222ms TTL=44
来自 140.82.112.4 的回复: 字节=32 时间=222ms TTL=44
140.82.112.4 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 222ms,最长 = 222ms,平均 = 222ms
Also I have tried regenerating the ssh key and then copying the public key correctly into the ssh configuration of my GitHub account as well, the local computer .ssh/config
file reads as follows
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
The result is still unsuccessful.
Does it seem to be connected properly? What can I do to fix it?
CodePudding user response:
ssh -vT [email protected] -A
: you are not supposed to use agent forwarding with github.com
itself.
The test should be:
# Attempt to SSH in to github
ssh -T [email protected]
> Hi USERNAME! You've successfully authenticated, but GitHub does not provide
> shell access.
Check the "Using SSH agent forwarding" documentation and see if it applies to your case.
Note: /c/Users/Administrator/.ssh/config
: it is best practice to not use your Windows Adminnistrator account, but rather your personal named account with which you initially logged to your Windows session.