Reputation: 21
I ran the same commands on the same git repos for 2 years, and this error suddenly occurred randomly to me. If I run it multiple times, then sometimes it works, sometimes it doesn't
I'm running "git fetch"
Fetching origin
kex_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch origin
I deleted my .ssh folder and recreated a ssh key in github, but it doesn't help.
Some debug log:
ssh -vvv [email protected]
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data
Upvotes: 0
Views: 442
Reputation: 489073
This:
Hi shengyaliu1212! You've successfully authenticated, but GitHub does not provide shell access.
indicates that everything is working just fine.
If everything always works with ssh
but never, or rarely, works when using an ssh URL with Git, that suggests—though does not in and of itself prove—that the ssh
command Git is running is a different version of ssh than the ssh
command you run. Check the core.sshCommand
setting in your Git configuration(s), and/or GIT_SSH
and/or GIT_SSH_COMMAND
in your environment. Be aware that Git-for-Windows comes with a bundled ssh version that is different from the Windows-provided ssh, so that's one very easy way to be using two different ssh
-es. You can simply use the one that works.
The remaining somewhat-likely possibility is that some middleman (ssh proxy, etc) is interfering in ssh between your system and Git, but this would generally cause all ssh connections to be iffy. Your ssh -v
test connection would likely have failed as well.
Upvotes: 1