Git log out user from command line

前端 未结 7 1430
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 16:22

Is there a command for logging out of git? I\'m turning my computer over to somebody else and don\'t want the git to be attached to my account in the terminal.

相关标签:
7条回答
  • 2020-11-29 16:54

    On a Mac, credentials are stored in Keychain Access. Look for Github and remove that credential. More info: https://help.github.com/articles/updating-credentials-from-the-osx-keychain/

    0 讨论(0)
  • 2020-11-29 16:59

    If you are facing any issues during push ( in windows OS), just remove the cached git account by following the given steps below: 1. Search for Control panel and open the same. 2. Search for Credential Manager and open this. 3. Click on Windows Credentials under Manage your credentials page. 4. Under Generic Credentials click on GitHub. 5. Click on Remove and then confirm by clicking Yes button. 6. Now start pushing the code and you will get GitHub popup to login again and now you are done. Everything will work properly after successful login.

    0 讨论(0)
  • 2020-11-29 17:01

    I was not able to clone a repository due to have logged on with other credentials.

    To switch to another user, I >>desperate<< did:

    git config --global --unset user.name
    git config --global --unset user.email
    git config --global --unset credential.helper
    

    after, instead using ssh link, I used HTTPS link. It asked for credentials and it worked fine FOR ME!

    0 讨论(0)
  • 2020-11-29 17:03

    I am in a corporate setting and was attempting a simple git pull after a recent change in password.

    I got: remote: Invalid username or password.

    Interestingly, the following did not work: git config --global --unset credential.helper

    I use Windows-7, so, I went to control panel -> Credential Manager -> Generic Credentials.

    From the credential manager list, delete the line items corresponding to git.

    After the deletion, come back to gitbash and git pull should prompt the dialog for you to enter your credentials.

    0 讨论(0)
  • 2020-11-29 17:13

    Remove your SSH keys from ~/.ssh (or where you stored them).

    Remove your user settings:

    git config --global --unset user.name
    git config --global --unset user.email
    git config --global --unset credential.helper
    

    Or all your global settings:

    git config --global --unset-all
    

    Maybe there's something else related to the credentials store, but I always used git over SSH.

    0 讨论(0)
  • 2020-11-29 17:17

    Try this on Windows:

    cmdkey /delete:LegacyGeneric:target=git:https://github.com
    
    0 讨论(0)
提交回复
热议问题