question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authentication Failed - not saving my new token permanently

See original GitHub issue

Describe the bug

I use self-hosted Gitea ( go-gitea/gitea ) as my git host. I have several repositories (all in the same host) added to GitHub Desktop.

GitHub Desktop has been working perfectly for me so far, while I was using a pure Username and Password (the same I use to log into Gitea).

As I have recently enabled 2FA, I have created a Token so that I can authenticate through Desktop.

When pushing to the repositories, as expected, the authentication failed and I have input my Username and the Token. The push succeeds. I’ve done this for a few other repositories where I had to push commits to.

However, countless times, for repositories that I had corrected the password already, I keep being asked for the password (“Authentication Failed”). It doesn’t always fail, but at least once I day, I guess this error. Fetching the repos don’t have this problem.

How can I permanently change the password/token for all repositories, and why is GitHub Desktop not doing that for me?

Version & OS

Version 2.4.2-beta1 Windows 10 Pro

Expected behavior

When “Authentication Failed” and I input the new Password/Token for the account, it should be saved permanently. Ideally, replace all occurrences of the previous password cached for all repos, but at least should not ask me anymore for this repo I’ve just changed.

Actual behavior

I keep getting the “Authentication Failed” when I push new commits later (not always, but frequently).

Screenshots

image

Logs

I see I’m getting loads of these, even for those repos I’m not actively committing to:

2020-04-20T20:15:54.202Z - error: [ui] git -c credential.helper= fetch --progress --prune --recurse-submodules=on-demand origin exited with an unexpected code: 128. stderr: remote: Users with two-factor authentication enabled cannot perform HTTP/HTTPS operations via plain username and password. Please create and use a personal access token on the user settings page fatal: Authentication failed for ‘XXXXXXXXXXXXXXXXXXXXXXX’

(The error was parsed as 3: Authentication failed. Some common reasons include:

  • You are not logged in to your account: see File > Options.
  • You may need to log out and log back in to refresh your token.
  • You do not have permission to access this repository.
  • The repository is archived on GitHub. Check the repository settings to confirm you are still permitted to push commits.
  • If you use SSH authentication, check that your key is added to the ssh-agent and associated with your account.)

(probably related to the auto-fetching, even though I’m not getting the “Authentication Failed” popups)

NOTE - I cannot really “log out” and “log back in” under Options, as this is not a GitHub account. It’s a self-hosted Gitea account. I am currently logged into GitHub in there (same username, by the way), but that account isn’t used for any of the repositories.

There is no place in Options where I can manage my login to a host other than GitHub.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rafecacommented, Apr 21, 2020

Thanks for filing this issue @nunoperalta ! GitHub Desktop stores the git credentials on the operating system keychain. On Windows, this is the Credential Manager.

Normally, Desktop should override the stored password with the new one you supply via the authentication failed dialog, I wonder why is this not working for you…

Can you try opening the Credential Manager app and look for “Generic Credentials” that start with “GitHub Desktop” and check that the URLs that appear there match the ones that you see on the authentication failed dialog?

image

(deleting the Desktop entries from the Credentials Manager willprobably fix the issue, but I’d like to know why they are not getting updated because there may be an underlying issue).

0reactions
nunoperaltacommented, Jan 13, 2022

Going to close this out in favor of #13537, which is a more recent report. @nunoperalta let us know if you are still having this issue.

No problem. Not sure if I have recently attempted to update my tokens, but I’ll let you know if I struggle with this again in the future. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where to store my Git personal access token? - Stack Overflow
15 Answers 15 · Navigate to your local repository folder. · In the current folder's terminal: git config --global --replace-all credential.
Read more >
Solved: OAuth Refresh token has expired after 90 days
We try to authenticate using an OAuth Refresh Token (this authentication mechanism has been recommended by the Yammer group "Partner Center Security Guidance", ......
Read more >
Token Best Practices - Auth0
Lists best practices when using tokens in authentication and authorization.
Read more >
View auto-provisioning errors - Google Workspace Admin Help
You'll see this error when the authorization code couldn't be exchanged for a refresh token. This can happen if your authorization code was...
Read more >
Outlook 2016 for Mac repeatedly prompts for authentication
To work around this issue, delete any cached passwords for your account, and also delete any modern authentication tokens from the keychain.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found