remote: Unauthorized fatal: Authentication failed Bitbucket

33,089

The user.name and user.email local config have nothing to do with git repos hosting server authentication. It is just for committer/authorship on commits.

If you are using an https url, that means you need to use the BitBucket login and password.
If there is a BitBucket account 'user2', then its BitBucket password will be enough to pass the authentication (he/she will need to be a collaborator in user3 project in order to have the right to push though)

Make sure there is no special character in the password, or you would have to percent-encode it.

Share:
33,089
Suraj
Author by

Suraj

Wannabe GEEK!

Updated on November 24, 2021

Comments

  • Suraj
    Suraj over 2 years

    Ok, so Here's the scenario,

    I had user1 logged in to my terminal for bitbucket account.

    I had logged in like

    $ git config --global user.name "user1"
    $ git config --global user.email "[email protected]"
    

    I was able to do commit and push perfectly.

    Now I had another account on bitbucket with another email id for user2.

    So I logged in like:

    $ git config --global user.name "user2"
    $ git config --global user.email "[email protected]"
    

    But now when I am doing git push origin master I am getting the below error.

    fatal: Authentication failed for 'https://[email protected]/user3/test.git/'
    

    So I completely uninstalled git from my Ubuntu 14.04 and installed it again and logged in again. But even then getting the same issue.

    How to avoid that error message?