Pushing to remote: Unauthorized

I would like to push my files. When I try to do it, I get a dialog where I have to give my username and password. Everything looks correct but after I press OK, I get the following error message:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags --set-upstream origin refs/heads/mybranch:refs/heads/mybranch

Pushing to https://bitbucket.org/----------.git

remote: Unauthorized

fatal: Authentication failed for 'https://bitbucket.org/---------.git/'

Pushing to https://bitbucket.org/------.git

remote: Unauthorized

fatal: Authentication failed for 'https://bitbucket.org/----------.git/'

Pushing to https://bitbucket.org/---------------------.git

remote: Unauthorized

fatal: Authentication failed for 'https://bitbucket.org/------------.git/'

Pushing to https://bitbucket.org/------.git

remote: Unauthorized

fatal: Authentication failed for 'https://bitbucket.org/------------.git/'

Completed with errors, see above

 

I just created my account an hour ago, it might be the reason but I am not sure. How could this issue be solved? It is quite urgent, I have 24hours to complete the push.

Thanks in advance!

1 answer

This widget could not be displayed.

Hi Biró! Are you getting this same error when you try pushing from the command line instead of Sourcetree? If you do, then the issue is not with Sourcetree itself but with the authentication. 

You can try removing all your credentials and entering them again. SourceTree accounts are stored in %localappdata%/Atlassian/SourceTree/accounts.json. If you're on Windows they are stored in the Credentials Manager or Vault with the 'git:' prefix. If you're on Mac, they are stored in the Keychain.

If you're still having issues after trying the above, let us know if you are on Windows or Mac, and also which Sourcetree version are you using.

Regards,

Ana

Hi Ana! I do not try to do it via the command line, I use Sourcetree's user interface. I just press the Push button placed between Pull and Fetch, then I select the Branches to push and click the Ok button.

I am using Mac OSX 10.11.4 (El Captain) and Sourcetree 2.6.3 (134).

Regards,
Biró

Hi Ana,

Is it possible to make the communication faster? My problem is still not solved and I am already 10 hours over the deadline. Could you please contact me via email, phone or Skype?

 

Thanks in advance,

Biro

Hi Biró, if you're able to try the command line it will help us know where the issue is what will lead to a more accurate answer. Can you try pushing from the command line and see if you receive the same error?

 

Also, can you confirm if you cleared the credentials from the Keychain? It's very possible that the Keychain has the wrong credentials stored for bitbucket.org.

Lastly, do you have 2FA enabled on your account?
Best regards,
Ana

Hi, unfortunately, it is  the same if I do it from the command line. I am 100% sure that I give the correct credentials.

 

user$ git push -u origin my_branch_name

Username for 'https://bitbucket.org': <my bitbucket username>

Password for 'https://my_bitbucket_username@bitbucket.org': <my bitbucket password>

remote: Unauthorized

fatal: Authentication failed for 'https://bitbucket.org/HTML24DK/brown_rabbit.git/'

I cleared the credentials from the keychain too. But anyway, when I tried to push via the command line my password and username were required (were not filled automatically by keychain). And if I understand it well, I do not have 2FA (two-step verification?) enabled on my account. When I navigate there, it says:

It looks like you aren't quite ready to set up two-step verification on your account. You'll need to address the following items before continuing.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

874 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you