When I try to connect using git, then I see this error
$ git clone [email protected]:MyCompany/eagle.git --verbose
Cloning into 'eagle'...
FATAL ERROR: Couldn't agree a key exchange algorithm (available: [email protected],ecdh-sh
a2-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.
I setuped all keys, etc and connection works fine, because when I do
ssh -v [email protected]
connection is successful.
What could I do to understand what went wrong and what should be corrected ?
Thanks,
Git does not know, or care. It just runs ssh. Specifies that ssh(1) should only use the authentication identity files configured in the ssh_config files, even if ssh-agent(1) or a PKCS11Provider offers more identities. The argument to this keyword must be “yes” or “no”.
If ssh -T [email protected]
gives you the:
Hi <name>! You've successfully authenticated, but GitHub
does not provide shell access.
message, that means your ssh setup is working. If you get a:
FATAL ERROR: Couldn't agree a key exchange algorithm ...
that means your ssh setup isn't working. Clearly there's a contradiction here, and the most likely culprit is that you have two different ssh
commands installed: one that you are using, which works, and another that Git is using, which doesn't.
This answer to Git with SSH on Windows has a lot of upvotes. I avoid Windows, so I have no idea whether this will help. (I don't even know if you're on Windows since you have not mentioned it.)
Note that Git version 2.3.0 added GIT_SSH_COMMAND
, and Git version 2.10.0 added core.sshCommand
to set a value for GIT_SSH_COMMAND
. Since then, Git version 2.13.0 learned some new tricks for dealing with issues tied to variations of ssh that demand different option letters. In all cases it's important to figure out which ssh Git is running, and make sure it runs one that actually works. See the top level Git documentation for a description of all the option variables and what they do. The link here goes to a web page that may not match your own Git version, so consider running git --help git
to read that version, if your Git is very old.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With