Pectus Excavatum
Pectus Excavatum

Reputation: 3785

Sourcetree cannot push to bitbucket repo due to authentication issue

This may seem like a bit of a rudimentary issue, but I cannot seem to push from Sourcetree (windows) to a bitbucket repo for which my user is the owner.

To clarify I can log in to the repo using my browser just fine but when I push to it from Sourcetree and I enter the same details into the prompt box it fails to authenticate. I have tried using the username and email, I've even changed the password of the account but still no joy.

I also created an app password and tried using that as the password with combinations of the username and email, but no joy.

the error I am getting is:

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks -c credential.helper= -c credential.helper="C:/Users//AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/GIT-CR~1.EXE" push -v --tags origin master:master fatal: HttpRequestException encountered. An error occurred while sending the request.

remote: Invalid username or password. If your organization manages your account or you've enabled two-step verification, create an app password to log in: https://confluence.atlassian.com/x/9DJmMQ fatal: Authentication failed for 'https://@bitbucket.org//.git/'

Pushing to https://@bitbucket.org//.git Completed with errors, see above.

Any advice would be greatly appreciated

Upvotes: 0

Views: 12134

Answers (4)

Siby Sunny
Siby Sunny

Reputation: 752

In order to get it worked I ended up going to Tools -> Options -> SSH Client configuration and changing it to OpenSSH. and set the path to the already generated ssh key file like C:\Users<user>.ssh\id_rsa.

enter image description here

Upvotes: 0

rufo
rufo

Reputation: 5577

I deleted:

  • C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree\passwd
  • C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree\accounts.json

Inspired by this article: https://community.atlassian.com/t5/Sourcetree-questions/Getting-quot-fatal-Authentication-failed-for-quot-error/qaq-p/624663

It worked. When I restarted SourceTree it acted like it was the first time it was opened (downloaded some tools, asked me for my credentials). Once it finished, my project tabs were there, and I was able to pull/push.

Upvotes: 1

Vishal
Vishal

Reputation: 742

Perform below steps:

git remote set-url origin Your-repository-url-here

Upvotes: 0

Tejashwi Kalp Taru
Tejashwi Kalp Taru

Reputation: 3074

Try to add a new SSH key via Sourcetree, seems like Sourcetree is not picking up your username and password when you are using HTTP/S authentication, it can be because:

  1. You have not added your account info in git global
  2. You have not properly assigned credentials

Using SSH is a far preferred way:

https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html#SetupanSSHkey-ssh3

Upvotes: 1

Related Questions