user14184824
user14184824

Reputation: 25

How can I changed git user password when changing user.name and user.email did not work?

I tried this way:

 git config --global user.name “username” 
 git config --global user.email  "email"  

and then git fetch && git checkout but no: Git still wants password from old user's.

Upvotes: 1

Views: 61

Answers (1)

VonC
VonC

Reputation: 1324228

The user.name/email is only about commit authorship, not about authentication.

Check your exact URL with git remote -v in order to check if it is an HTTPS one, or an SSH one ([email protected]).
I mention SSH because some time the passphrase of a private key is interpreted as a "password".

If it is an HTTPS one, check your git config credential.helper.
Depending on your OS, it could be "manager" or osxkeychain or ...

If the old user is cached and used, you need to remove it from the credential helper, then try and push again: a popup should appear, asking you to enter this time the right user/password.

A good tip when changing user is to make sure that new user login is part of the remote URL:

cd /path/to/repo
git remote set-url origin https://<New-Username>@bitbucket.org/<aUser>/<aRepo>

Upvotes: 1

Related Questions