1

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.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283

1 Answers1

1

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 (git@bitbucket.org).
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>
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283