Reputation: 21486
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://[email protected]/example/foobar.git
. Yesterday I created a Bitbucket app password. I then went directly into Window Credential and found the credential for git:https://[email protected]
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://[email protected]
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://[email protected]
and git:https://bitbucket.org
credentials say "Modified: Today". There is a new git:https://[email protected]/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.
Upvotes: 6
Views: 22764
Reputation: 1329292
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".
Upvotes: 2
Reputation: 411
Here's what worked for me:
Go to Control Panel - Credential Manager - Manage Windows Credentials.
Find the credentials for @bitbucket.org
Choose "Edit" and change the password for them to the app password
Verify via a "git push".
Upvotes: 6