Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remote: Unauthorized fatal: Authentication failed Bitbucket

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?

like image 916
Suraj Avatar asked Jan 26 '16 06:01

Suraj


1 Answers

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.

like image 168
VonC Avatar answered Oct 06 '22 07:10

VonC