Remove credentials from Git

后端 未结 30 1667
不知归路
不知归路 2020-11-21 10:13

I\'m working with several repositories, but lately I was just working in our internal one and all was great.

Today I had to commit and push code into other one, but

相关标签:
30条回答
  • 2020-11-21 10:26

    Got same error when doing a 'git pull' and this is how I fixed it.

    1. Change repo to HTTPS
    2. Run command git config --system --unset credential.helper
    3. Run command git config --system --add credential.helper manager
    4. Test command git pull
    5. Enter credentials in the login window that pops up.
    6. Git pull completed successfully.
    0 讨论(0)
  • 2020-11-21 10:26

    For macOS users :

    This error appears when you are using multiple Git accounts on the same machine.

    Please follow below steps to remove the github.com credentials.

    1. Go to Finder
    2. Go to Applications
    3. Go to Utilities Folder
    4. Open Keychain Access
    5. Select the github.com and Right click on it

    Delete "github.com"

    Try again to Push or Pull to git and it will ask for the credentials. Enter valid credentials for repository account. Done

    0 讨论(0)
  • 2020-11-21 10:27

    If this problem comes on a Windows machine, do the following.

    • Go to Credential Manager
      • in German, it is called: Anmeldeinformationsverwaltung
      • in French, it is called: Gestionnaire d'identification
    • Go to Windows Credentials
    • Delete the entries under Generic Credentials
    • Try connecting again. This time, it should prompt you for the correct username and password.

    0 讨论(0)
  • 2020-11-21 10:29

    The Git credential cache runs a daemon process which caches your credentials in memory and hands them out on demand. So killing your git-credential-cache--daemon process throws all these away and results in re-prompting you for your password if you continue to use this as the cache.helper option.

    You could also disable use of the Git credential cache using git config --global --unset credential.helper. Then reset this, and you would continue to have the cached credentials available for other repositories (if any). You may also need to do git config --system --unset credential.helper if this has been set in the system configuration file (for example, Git for Windows 2).

    On Windows you might be better off using the manager helper (git config --global credential.helper manager). This stores your credentials in the Windows credential store which has a Control Panel interface where you can delete or edit your stored credentials. With this store, your details are secured by your Windows login and can persist over multiple sessions. The manager helper included in Git for Windows 2.x has replaced the earlier wincred helper that was added in Git for Windows 1.8.1.1. A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. The manager helper offers the same GUI interface as winstore.

    Extract from the Windows 10 support page detailing the Windows credential manager:

    To open Credential Manager, type "credential manager" in the search box on the taskbar and select Credential Manager Control panel.

    And then select Windows Credentials to edit (=remove or modify) the stored git credentials for a given URL.

    0 讨论(0)
  • 2020-11-21 10:29

    Retype:

    $ git config credential.helper store
    

    And then you will be prompted to enter your credentials again.

    WARNING

    Using this helper will store your passwords unencrypted on disk

    Source: https://git-scm.com/docs/git-credential-store

    0 讨论(0)
  • 2020-11-21 10:29

    You can remove the line credential.helper=!github --credentials from the following file C:\Program Files\Git\mingw64\etc\gitconfig in order to remove the credentials for git

    0 讨论(0)
提交回复
热议问题