Authentication failed to bitbucket

点点圈 提交于 2019-11-27 19:52:22

问题


I'm trying to push my project via the https protocol on bitbucket using sourcetree.
But I can't connect to bitbucket with my login and password (which work on the website), I have a fatal error : "Authentication failed".

I read on other posts I can work around the problem using the ssh protocol instead of the https one, so I set up a ssh key following instructions on the source tree faq. But now I don't know how I can change to the ssh protocol when I want to push my code. Someone know how I can do this ? Thank you.


回答1:


If you got authentication issues with the GIT console you can try your auth this way :

https://<username>:<password>@bitbucket.org/<username>/<repo>.git



回答2:


I recently had a similar issue with SourceTree: any time I tried to push/pull/fetch to/from the remote origin I would get an authentication error (using SourceTree with Stash). Sometimes I would be challenge in Stash with a CAPTCHA but it never made a difference if I provided the correct information or not.

For me, we're using SourceTree and Stash in a corporate environment; user accounts are based on network credentials. Part of our network security requires us to change those passwords on a regular basis.

I was operating under the assumption that SourceTree/Stash was "aware" of any change made to my network password. But apparently -- at least in this instance -- it was not.

To fix, all I needed to do was:

Tools > Options > Authentication > Edit (Edit Password)

I set the password to match my current network password and everything began working as expected.

Not sure if this helps the OP but I hope it may help someone else looking for answers to a similar issue.




回答3:


Tools -> options -> git and selecting 'use system git' did the magic for me.




回答4:


I solved the issue by editing the stored value in the OS X Keychain: I looked for "bitbucket" (as Application password) and changed the value.

Then on Sourcetree, when I tried to push, I directly had to re-enter my new password.




回答5:


The issue was solved for me after changing the repository password, using no special characters (!"§$%&&).

Obviously, win-credential-store and git and bitbucket's web interface use different character encodings.

complete procedure:

D:\shared\Project> cd /path/to/your/project
D:\shared\Project> git init
D:\shared\Project> git remote add origin https://bitbucket.org/USERNAME/project.git
D:\shared\Project> git-credential-winstore.exe

then

D:\shared\Project> git push
Failed to erase credential: Element not found
fatal: Authentication failed for 'https://bitbucket.org/USERNAME/project.git/'

After changing the passphrase:

D:\shared\Project> git push
Counting objects: 102, done.
Delta compression using up to 8 threads.
... etc. ...

Settings in Windows tresory:

address: git:bitbucket.org (remeber the preceding "git:")
user: USERNAME
pass: old incl!"§§$%&, new without!"§$%%&/( (your passphrase!)



回答6:


I Reverted to sourcetree 2.0

This solved the bug for me.

https://www.sourcetreeapp.com/download-archives




回答7:


I tried everything else and found helpless but this indeed worked for me "To update your credentials, go to Control Panel -> Credential Manager -> Generic Credentials. Find the credentials related to your git account and edit them to use the updated passwords".

Above Solution found in this link: https://cmatskas.com/how-to-update-your-git-credentials-on-windows/




回答8:


I had the same problem. It has something to do with a bug in Git for Windows. For me it was enough to change Git used in SourceTree to the embedded one:

Tools -> Options -> Git and click button 'Use Embedded Git'




回答9:


Tools > Options > Use System Git , then select the git.exe file

The credentials will be required again, and the problem will be solved.




回答10:


If you made an account using google/ other oauth, then you need to set a bitbucket password for your account first. The URL for that is : https://bitbucket.org/account/user// or look for Bitbucket settings under the menu.

Then can login from git (I tried via command line). I use the built in manager for credentials :

credential.helper=manager

Now, after I set the password on the bitbucket site (email verified too), and tried to push again, it prompted me for the password, then pushed the code.

Menu location image on bitbucket web page -> http://ctrlv.in/747291 as of May 2016.




回答11:


After fighting with this for a long time, it looks like I found something that seems to work. I was optimizing the urls to not include the username (keep it as generic as possible), but the authentication dialog kept popping up:

I tried everything that came into mind, such as:

  1. Enable and disable MFA (Multi Factor Authentication)
  2. Create app passwords (again, with and without MFA enabled)

No matter what tools I used (including SourceTree), nothing worked. The server kept returning: "Create an app password"

Basically you must

  1. Use the url including the username (e.g. https://myusername@bitbucket.org/...)
  2. Use an app password created in bitbucket

Would be so nice if the server would have returned this in the response instead of suggesting to use an app password...




回答12:


I had the same problem. You need to go and add an app password for sourcetree in your bitbucket settings. Click "Bitbucket settings" in menu, App passwords, create app password. Then go to SourceTree and edit your saved password




回答13:


On Mac, I needed to go to Preferences > Accounts, then add a new account as Bitbucket Server and enter my company's bitbucket server URL. Then I had to choose HTTPS as the protocol and enter my username (without @email) and password.

Also I set this new account as the default account by clicking the Set Default... button in the bottom of the Preferences > Account page.




回答14:


This problem occurs because the password of your git account and your PC might be different. So include your user name as shown in the below example:

https://myusername@bitbucket.org/...

https: //devi@bitbucket.org/...




回答15:


For Mac Users. There was a default account set on Source tree which does not allow me to clone the Url because my present Url was of different bitbucket account. So, It shows the invalid source path and i then click on Advance Options and found Authentication failed to your_clone_url. So follow these steps

  1. Select Source Tree. Go to SourceTree menu -> Select Preferences.
  2. It will show Accounts window. Then Choose Accounts

Here it will show list of your added accounts. Just click on Add button from the bottom and add your new bitbucket account details. It will list you account under Accounts tab. You can also set default account by clicking on Set Default .. button from bottom. Now all is done.




回答16:


None of the above worked for me - the problem lay in my Sourcetree Preferences. In the Network tab, I had a setting there for 'Default usernames for URLs which do not include one:'. The username was incorrect where I had entered it incorrectly previously - I had set it to my email rather than username. I highlighted the entries and clicked Remove for both. Then I returned to my repository page and clicked Push again. On pushing, it asked me for full username and password, which I was able to enter correctly - the push then finally worked.




回答17:


  • Inside company but will held true anywhere.
    • Logout from Bitbucket ( in case you are using)
    • Login with your credential
    • Go back to console
    • Fire the same command
    • It will ask for password - Provide it.
    • You are good to go.



回答18:


The issue for me was that I did not have an account added to Sourcetree.

Adding an account allowed me to push to my repo:

Tools > Options > Authentication > Add > Refresh OAuth Token




回答19:


I tried almost all the solution given here.

Which worked for me is I opened the GIT GUI and in that tried to Push. Which ask for the credentials, enter correct userid and password it will start working again.




回答20:


I was using below command

git clone -b branch-name https://<username>@bitbucket.org/<repository>.git

Issue got resolved after adding password with username (see below command):

git clone -b branch-name https://<username>:<password>@bitbucket.org/<repository>.git



回答21:


In windows this worked for me

git config --global http.sslVerify false



来源:https://stackoverflow.com/questions/20953940/authentication-failed-to-bitbucket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!