Bitbucket – when you suddenly cannot login with git username/password from git any more
Posted by jpluimers on 2017/05/16

When logging in using the Web UI with a username
As of a few days, I was getting this error in my SourceTree output when pushing to git :
remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
I think this is at least related to a change Bitbucket made 2 years ago for their site logon:
You can no longer log in with a username. Use your Atlassian account email address instead.
Source: Bitbucket
Pushing to bitbucket with cached credentials from SourceTree has worked for months. One thing that was different now (and should have given me a clue) the broken [WayBack] broken Git Credentials Manager popup showed but should not have.
When you get this credential manager you have to escape it as otherwise you will get an “Empty password
” error.
Initially I blamed the error on the SourceTree 2.x upgrade I did last week. Unlike previous upgrades, this one had kept the old version (in my case 1.9.13.7) around and after a few clicks (skipping the “go to download page” prompt forever) and closing SourceTree 2.0, I fas able to start SourceTree 1.9 again.
SourceTree 1.9 had the same problem which meant it was either git itself, or the Bitbucket back-end.
To prove it was the Bitbucket back-end, I did everything An example of this is in the output below.
Solving the problem
What helped were these steps:
- Change the git repository from
https://jeroenp@bitbucket.org/jeroenp/fastmm.git
tohttps://bitbucket.org/jeroenp/fastmm.git
- Change the “username” field for the bitbucket repository to be my email address.
- Remove any bitbucket cached credentials from SourceTree.
- Restart SourceTree.
- Performing a push
- Cancel the Git Credential Manager popup
- Use my primary bitbucket email address for logon
Now SourceTree happily cached my credentials.
I’ve used this to scan the git config files for ones starting with a username:
grep -inSwl jeroenp@bitbucket config
Notes:
- You have to use your primary bitbucket email address, otherwise it will fail: [WayBack] Cannot log into my bitbucket account – Atlassian Community
- Some people even disable the Git Credential Manager: [WayBack] Bitbucket fails to authenticate on git pull – Stack Overflow
From the console
Reproduction of the issue:
C:\Users\jeroenp\Versioned\FastMM>git --version git version 2.12.2.windows.1 C:\Users\jeroenp\Versioned\FastMM>git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream bitbucket develop:develop Pushing to https://jeroenp@bitbucket.org/jeroenp/fastmm.git Logon failed, use ctrl+c to cancel basic credential prompt. Password for 'https://jeroenp@bitbucket.org/': remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile. fatal: Authentication failed for 'https://jeroenp@bitbucket.org/jeroenp/fastmm.git/'
This has worked for months (after [WayBack] canceling the Git Credentials Manager popup as that has been broken for a very long time and gives you a remote: Empty password
).
What helped was this:
C:\Users\jeroenp\Versioned\FastMM>git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream bitbucket develop:develop Pushing to https://bitbucket.org/jeroenp/fastmm.git Logon failed, use ctrl+c to cancel basic credential prompt. Username for 'https://bitbucket.org/': jeroen...@....com Password for 'https://jeroen...@....comcom@bitbucket.org/': Total 0 (delta 0), reused 0 (delta 0) POST git-receive-pack (196 bytes) remote: remote: Create pull request for develop: remote: https://bitbucket.org/jeroenp/fastmm/pull-requests/new?source=develop&t=1 remote: To https://bitbucket.org/jeroenp/fastmm.git xxxxxxxx..xxxxxxxx develop -> develop updating local tracking ref 'refs/remotes/bitbucket/develop' Branch develop set up to track remote branch develop from bitbucket.
–jeroen
Leave a Reply