0

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

Tejashwi Kalp Taru
  • 2,994
  • 2
  • 20
  • 35
Pectus Excavatum
  • 3,593
  • 16
  • 47
  • 68
  • In the end i just used cli to push, but afterwards discovered my oauth token had expeired and needed refreshed. Bit rubbish that sourcetree couldn't try to detect and refresh, nor could it give a decent error during the push action. Oh well, I will take your advise and move to ssh – Pectus Excavatum Aug 07 '18 at 10:43
  • I was having this error today too. weird. I re-added my oauth, but it still didn't work – karamazovbros Aug 07 '18 at 17:26

4 Answers4

1

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

Tejashwi Kalp Taru
  • 2,994
  • 2
  • 20
  • 35
1

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.

rufo
  • 5,158
  • 2
  • 36
  • 47
0

Perform below steps:

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

Vishal
  • 639
  • 7
  • 32
0

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

Siby Sunny
  • 714
  • 6
  • 14