2

I'm using Git 2.35.1.windows.2 on Windows 10. I understand that this version uses the Windows Credential Manager. Bitbucket recently deprecated the use of the Bitbucket account password for HTTPS Git requests in favor of app passwords.

I have a repository with a Bitbucket remote URL in the form https://user@bitbucket.org/example/foobar.git. Yesterday I created a Bitbucket app password. I then went directly into Window Credential and found the credential for git:https://user@bitbucket.org and manually set the password to the new app password I created. (I assumed that this changed the credential for git:https://bitbucket.org as well, as both said "Modified: Today".)

However whenever I do a git push for the repository, the response still says:

remote: You are using an account password for Git over HTTPS.
remote: Beginning March 1, 2022, users are required to use app passwords
remote: for Git over HTTPS.
remote: To avoid any disruptions, change the password used in your Git client
remote: to an app password.
remote: Note, these credentials may have been automatically stored in your Git client
remote: and/or a credential manager such as Git Credential Manager (GCM).
remote: More details:
remote: https://bitbucket.org/blog/deprecating-atlassian-account-password-for-bitbucket-api-and-git-activity

Oddly in Windows Credential Manager both the git:https://user@bitbucket.org and git:https://bitbucket.org credentials say "Modified: Today", even though I tried to change them to the app password yesterday.

Why didn't my manually updating Windows Credential Manager update the credentials for this repository to the new app password? How is the best way to update to the new app password?

Update 2022-03-12: Atlassian apparently finally disabled using the account password, so when I tried to git push today it popped up a dialog asking for my credentials. I entered the app password in the UI (strangely it talked about SourceTree, when I was using Git from the command line), and finally it accepted the new password. In Windows Credential Manager both the git:https://user@bitbucket.org and git:https://bitbucket.org credentials say "Modified: Today". There is a new git:https://user@bitbucket.org/refresh_token entry as well.

Now Git on the command line seems to work, but oddly the command still says the following (even though the command succeeds):

fatal: invalid credentials

From a Visual Studio Developer Community comment, though, this may be completely unrelated:

The bitbucket.org part of GCM Core is reporting a “fatal: Invalid credentials” line on the standard error stream, which is what is causing the “Failed to push” error message to appear.

Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
  • I see the exact same message from Bitbucket and have the exact same question. I've switched to the Git Credentials Manager Core. I can't figure out how to get git for Windows to re-prompt me for the password (at which point I assume I'd enter the app password, but I'm not sure yet). – Donnie Hale Feb 23 '22 at 21:37
  • Any progress on this? I have same issue. – Mike Flynn Mar 12 '22 at 17:28

2 Answers2

3

Here's what worked for me:

  1. Go to Control Panel - Credential Manager - Manage Windows Credentials.

  2. Find the credentials for @bitbucket.org

  3. Choose "Edit" and change the password for them to the app password

Verify via a "git push".

Donnie Hale
  • 381
  • 1
  • 3
  • 12
  • How is that procedure different from what I described in the question? Are you saying I have to update `git:https://bitbucket.org` instead of `git:https://user@bitbucket.org`? Is that the difference? – Garret Wilson Feb 26 '22 at 17:10
  • I think I misunderstood your comment about Windows Credential Manager. My apologies. I did see 2 "bitbucket.org" credentials in it, and I changed them both to the app password. – Donnie Hale Feb 28 '22 at 13:31
  • One extra note, Visual Studio creates some credentials with the username like `PersonalAccessToken`. Replace that with your username as well to make this work. – Bart Friederichs May 04 '22 at 10:12
0

Make sure that C:\Program Files\Git\mingw64\libexec\git-core is in your PATH, and check what password is associated with your remote server:

printf "host=bitbucket.org\nprotocol=https" | git credential-manager-core get

You might have multiple entries.
To be sure of the result, I would first remove them:

printf "host=bitbucket.org\nprotocol=https" | git credential-manager-core erase

Repeat until you see a prompt asking for your credentials.
Do npt enter them: click Cancel.

Then store your credentials using your app token:

printf "host=bitbucket.org\nprotocol=https\nusername=xxx\npassword=<token>" | git credential-manager-core store.

And you are good to go!

Note: if you have 2FA, you might need to latest GCM v2.0.692, which allows "Sign in with OAuth".

https://user-images.githubusercontent.com/5658207/146974049-dd66c3bf-1291-4c39-b83f-86f13cd1019b.png

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250