desktop: Authentication failed when pushing to my repository

Description

I have a repository that I have used for several months, and suddenly last week I was unable to push my changes. The client shows the following error: Authentication failed. You may not have permission to access the repository or the repository may have been archived. Open options and verify that you're signed in with an account that has permission to access this repository. I tried signing out and in again, and still the same issue. I did Repository > Open in Command Prompt and git push which gave me a slightly more detailed error:

FATAL ERROR: Couldn't agree a key exchange algorithm (available: 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.

Version

GitHub Desktop version: 1.0.13

OS version: Microsoft Windows [Version 10.0.16299.248]

Steps to Reproduce

  1. Start GitHub client
  2. Try to push a changeset
  3. šŸ˜ž

Expected behavior: Pushes successfully

Actual behavior: Failed to push

Reproduces how often: 100%

Logs

(The error was parsed as 2: Authentication failed. You may not have permission to access the repository or the repository may have been archived. Open options and verify that you're signed in with an account that has permission to access this repository.)
2018-02-26T00:13:35.744Z - error: [ui] `git -c credential.helper= fetch --progress --prune origin` exited with an unexpected code: 128.
FATAL ERROR: Couldn't agree a key exchange algorithm (available: 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.

This section is repeated for each of my failed attempts to sync.

Additional Information

Update: I suspected an old version of PuTTY was the problem (0.66) but upgrading to the latest (0.70) didn’t help.

Update 2: Still suspecting PuTTY to be related. I deleted the entry for github.com in registry Computer\HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys and did putty github.com to add it back. Then I got a different error when trying git push:

FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)
fatal: Could not read from remote repository.

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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I’m also having the same problem. I’ve tried updating PUTTY, Git Extensions, deleting all my keys from Github and re-adding, re-adding github.com fingerprint, but I still can’t get access to push to my repo. What can I do? I just need to push code!

FATAL ERROR: Couldn’t agree a key exchange algorithm (available: 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.

My problem turned out to be an old version of Putty that was bundled with Git Extensions. If you’ve got the latest Putty installed then make sure you don’t have a second version installed somewhere else which is being found. If you don’t have the latest Putty, upgrade.

Interesting, I downloaded PuTTY yesterday and it included PuTTYgen with the ED25519 option. Pageant seems to support it (Windows 7 64bit):

puttygen

I’m late to the party but i’ve also struggled with this (i’m not using any extension though, just command line).

My problem was related to a probably outdated TortoisePlink.exe that i think was bundled with git for windows. What i did was to

  • download the latest plink.exe here https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
  • edit GIT_SSH environment variable and make sure it points to plink.exe
  • close any shell, terminal, ide, etc. because they cache the env variables
  • open putty and make a ssh connection to git@github.com, so you’ll get eventually prompted the fingerprint window, check the data and press Y, then close putty

The last step is required because apparently there’s something weird happening between git bash and plink.exe so that when the terminal is asking Store key in cache? (y/n), your keyboard input won’t be piped properly and your compulsive ā€˜Y’ strokes will be lost in the empty void.

If you are having a similar issue, you should see a popup window with this message

Authentication failed. You may not have permission to access the repository or the repository may have been archived. Open options and verify that you're signed in with an account that has permission to access this repository.

if you didn’t get this fixed with any of the above suggestion then open task manager while that popup is still opened, search the window name in the applications list, then right click and ā€œgo to processā€, then right click the process and ā€œgo to fileā€. Your problem most likely is in that very file. Cheers.

I had the same issue with GitExtensions although I had it configured to use separately installed PuTTY 0.70. Instead of using plink.exe from the path in the SSH settings, GitExtensions was using the bundled version. After renaming C:\Program Files (x86)\GitExtensions\PuTTY to C:\Program Files (x86)\GitExtensions\PuTTY2 and redefining the paths in SSH settings it started to work.

It worked when I deleted all my private keys from GitHub.com and then re-added public key for the same key I used before. Strange…

@NichUK please also try updating your Git for Windows installation. If you’re still unable to push, Git for Windows is the place to report an issue.