Search code examples
bitbucketatlassian-sourcetree

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


Solution

  • 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