remote: Unauthorized fatal: Authentication failed Bitbucket
Asked Answered
T

4

9

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?

Tarratarradiddle answered 26/1, 2016 at 6:53 Comment(0)
T
2

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.

Tales answered 26/1, 2016 at 7:28 Comment(7)
I do have ! In my password. Could be this be the issue. Let me checkTarratarradiddle
Instead of ! I should use %21 ??Tarratarradiddle
@Tarratarradiddle Not if you type it directly (like, for instance, when you log in to BitBucket). Only if you use it in an url.Tales
@Tarratarradiddle if you use user:yourpassword%[email protected]/users/user3/test.git, then you would encode the password. But first: can you login to BitBucket through bitbucket.org/account/signin/?next=/account ? (using your password with a regular !)Tales
Let us continue this discussion in chat.Tarratarradiddle
I am facing the same issue. Can you @VonC, tell me how can I solve this? I cannot read your chat further!Lachrymatory
@JaynaTanawala That would be best addressed as a separate question, but the general approach these days (as opposed to 2016 when I write this answer) is to use an HTTP access token (confluence.atlassian.com/bitbucketserver/…), as in https://mcmap.net/q/1319726/-why-is-personal-access-token-not-working-for-bitbucket-rest-apiTales
S
1

My problem was that I was using https instead of ssh, after that change everything worked for me.

Siegler answered 14/4, 2021 at 12:54 Comment(0)
O
0

I faced the same problem! Even after providing correct password it showed the same error.

Solution

Step:Just check your pass is correct. if it is OK then check you have the correct permission on that repository. (i got permission problem and solved using the step)

Ormiston answered 30/7, 2017 at 9:24 Comment(0)
J
0

I had similar issue, in one of my computers. I and was able fix the problem by commenting/removing these lines in the file ~/.gitconfig

[url "https://:@repo.zzz.xxx"]
insteadOf = https://repo.zzz.xxx
Jointly answered 21/4, 2022 at 18:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.