简体   繁体   中英

Windows Git-bash fatal: Could not read from remote repository. when pushing through ssh

I'm using Windows Git-bash to push to my repository using ssh (not https). I have followed the instructions in this page

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

$ ssh-keygen -t rsa -b 4096 -C "barghouti_since88@hotmail.com"
$ ssh-add ~/.ssh/id_rsa

Then copied the key in ~/.ssh/id_rsa and copied it to my ssh keys in github account by following this setup

https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

But now when I try to push using

$git add file
$git commit -m "adding file"
$git push

I'm getting the following

FATAL ERROR: Couldn't agree a key exchange algorithm (available: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521)
fatal: Could not read from remote repository.

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

There are a few possibilities you can examine:

  • did you "git clone" the repository with 'https' instead of 'git'? If you want to git push with ssh, you need to clone with ssh as well.
  • is your Git for Windows version recent enough ? every once in a while, GitHub removes support for older, weaker, crypto, and your software needs to match the server's algorithms, which in this case it didn't, per the error message.
  • are you using the same ssh software as git ? Git for Windows comes with ssh included, but ssh can also have been installed separately, on its own as OpenSSH, or included with putty, for instance. Compare the output of 'where ssh-keygen' with the environment variable GIT_SSH.

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM