Reputation: 7605
I use BitBucket and had to change my password because it was compromised.
git pull
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://bitbucket.org/myusername/myproject.git/'
How can I change my password using command line?
Upvotes: 113
Views: 198014
Reputation: 7605
You need to reset the password as shown below.
On macOS:
git config --global credential.helper osxkeychain
On Windows 10/11:
git config --global credential.helper store
After executing this, it prompts you for the user name and password for your repo.
Upvotes: 198
Reputation: 1
This helps me.
Run git remote -v
to see the current remote URL.
$ git remote -v
origin https://[email protected]/tutorials/tutorials.git.bitbucket.org.git (fetch)
origin https://[email protected]/tutorials/tutorials.git.bitbucket.org.git (push)
Update the remote URL with git remote set-url using the current and new remote URLs.
$ git remote set-url origin [email protected]:tutorials/tutorials.git
https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/
Upvotes: 0
Reputation: 3289
For myself only a combination of the approaches by @software-is-fun and @dev-adgh1 worked.
The cause was, that I changed my password (SSO) and did not use a token for our company repository. I am using Windows 10 and this is the only repository I wanted to have this authentication credentials be used.
So I did the following:
git config --local credential.helper store
in the directory where my repository was locatedgit pull
in your local repository directory and get prompted with the new login (where I entered my username and the token - not the password).Working :)
Upvotes: 0
Reputation: 192
I solved it this way.
If you use sourcetree, go to tools->options->Authentication->Accouns Edit and Authentication OK. Then, when i tried again no problem.
Upvotes: -1
Reputation: 35
I was facing the issue on Windows 10 after changing my password for bitbucket. I just opened git bash
in my repo location; Wrote command for
git push --set-upstream origin <branch_name>
It opened git credential manager window and asked for credentials. I entered the new one and it pushed successfully.
Upvotes: 1
Reputation: 392
Sometimes it happens when you change the remote bitbucket account password.
Solution
Go to Control panel => User Accounts => Credential Manager => Windows Credentials => move to Generic credentials and change the password of account
Upvotes: 3
Reputation: 11
Upvotes: 1
Reputation: 129
If you've changed the password on Windows 10, go to credential manager and update the password:
Upvotes: 8
Reputation: 2192
For me the issue was I changed my username so the git url also got changed. So I had to set the new git url using
git remote set-url origin <URL>
Upvotes: 3
Reputation: 263
I was facing same error, But I didn't need to change my password.
Just go to bitbucket->preferences->accounts
select your account and check if your password is correct.
In my case, my password was messed up. Just corrected my password and it worked.
Upvotes: 3
Reputation: 1398
I know that this is an old question, but I thought I would provide the solution that worked for me. I signed up for bitbucket using my google account and did not have a password. Turns out the password is my Atlassian account password. If you have an Atlassian account then try this password to see if it works.
Upvotes: 0
Reputation: 364
If you are a mac user this worked for me:
Then it will ask you for the password again.
Upvotes: 22
Reputation: 119
I clicked on this button and it worked for me.
Here is the screenshot
Upvotes: 10
Reputation: 11683
You can update your Bitbucket credentials from the OSX Keychain.
Updating your cached credentials via the command line:
$ git credential-osxkeychain erase
host=bitbucket.org
protocol=https
[press return]
If it's successful, nothing will print out. To test that it works, try and clone a repository from Bitbucket. If you are prompted for a password, the keychain entry was deleted.
Upvotes: 6
Reputation: 341
Lately, BitBucket needs you to generate an App Password:
Settings/Access Management/App Passwords.
https://bitbucket.org/account/user/.../app-passwords
Upvotes: 34
Reputation: 11949
If you found authentication error problem when you entered correct password and username it's git problem. To solves this problem when you are installing the git in your machine uncheck the enable git credential manager
Upvotes: 5
Reputation: 4575
This answer is for SO users who browse here after searching for the error.
In my case, nothing worked because I changed my username in Bitbucket.
Atlassian and Bitbucket are not completely integrated. Bitbucket uses the Atlassian user email and web app password, but allows you to have a different username.
There seems to be a bug in this process, especially since it's not clear which application or process is generating the authentication and where it's stored or editable. Changing the username breaks authentication.
There may be a way to update the username used by the credentials and Bitbucket, but I was already several hours behind when I discovered that changing my username back to what it was before restored authentication.
Upvotes: 3
Reputation: 2222
First, edit your .git/config and remove your username from 'url'.
I had this:
url = https://[email protected]/pathto/myrepo.git
And after modification:
url = https://bitbucket.org/pathto/myrepo.git
Then try to pull (or push) and use your email and password credentials to login.
Upvotes: 50
Reputation: 8200
I needed to do this and run a git pull in order to set my password from the command line in order to get this working.
Note this method saves your password in a plain text file on your disk:
git config --global credential.helper store
git pull
Other solutions here: Is there a way to skip password typing when using https:// on GitHub?
Upvotes: 15
Reputation: 775
I think is only an authentication problem...
That's all :)
Upvotes: 60