my old username is still in use

后端 未结 2 1478
深忆病人
深忆病人 2020-12-11 13:55

I have changed my user and email for git with those commands

git config --global user.name \"maa\"
git config user.email \"maa@gmail.com\"

相关标签:
2条回答
  • 2020-12-11 14:35

    Locally:

    git config credential.username "new_username"
    

    Globally:

    git config --global credential.username  "new_username"
    
    0 讨论(0)
  • 2020-12-11 14:41

    The user.name and user.email settings are only used for commit meta data.

    As I can see you are using https transport, so the username is stored somehow. To my mind there are two options:

    1. You are using %HOME%/.netrc (%HOME%/_netrc or %HOMEDRIVE%%HOMEPATH%\_netrc on Windows)
    2. Your username is included in the push-url (like https://username@github.com/...), here you need to update .git/config, e.g. by issuing git remote set-url https://<newusername>@github.com/<newusername>/yourRepo
    3. You are using a git credential helper. Here it depends which one you use (and maybe which OS you use, see for Windows, Mac OS X).

    As a general rule you can try the following on the CLI (based on 2), where you replace $credentialhelper with your credential-helper (you can find it using git config credential.helper, for Mac OS X it is likely osxkeychain on Windows it might be wincred or manager):

    $ git credential-$credentialhelper erase
    host=github.com
    protocol=https
    [Press Return]
    
    0 讨论(0)
提交回复
热议问题