Remove credentials from Git

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 I’m having some troubles.

  • git credential fill rejects my input
  • Where's the encryption key stored in Jenkins?
  • git credential.helper=cache never forgets the password?
  • How can I git clone from powershell without typing credentials?
  • How do I force git NOT to prompt for credentials
  • What is the password for jenkins user during first installation?
  • $ git push appharbor master
    error: The requested URL returned error: 403 while accessing https://gavekortet@appharbor.com/mitivo.git/info/refs?service=git-receive-pack
    fatal: HTTP request failed
    

    There is nothing I can do, that would bring the password entry again.

    How can I reset the credentials on my system so Git will ask me for the password of that repository?

    I have tried:

    • git config --global --unset core.askpass

    in order to unset the password

    • git config credential.helper 'cache --timeout=1'

    in order to avoid credentials cache…

    Nothing seems to work; does anyone have a better idea?

  • How to see changed lines with certain words and the containing file for a git commit? - Can git diff print a file name line prefix?
  • How to find the hash of branch in Git?
  • Push to a remote origin on a subfolder of git repository?
  • Meta-alias in Git Bash
  • How to get the git repository that I cloned before?
  • Should I add the Rails 4 bin/ directory to git?
  • 14 Solutions collect form web for “Remove credentials from Git”

    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 manual detailing the Windows credential store panel:

    Open User Accounts by clicking the Start button Picture of the Start button, clicking Control Panel, clicking User Accounts and Family Safety (or clicking User Accounts, if you are connected to a network domain), and then clicking User Accounts. In the left pane, click Manage your credentials.

    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

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

    • Go to Credential Manager
    • 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.

    Go to Credential Manager

    Go to Windows Credentials and Delete the entries under Generic Credentials

    I found something that worked for me. When I wrote my comment to the OP I had failed to check the system config file:

    git config --system -l
    

    shows a

    credential.helper=!github --credentials
    

    line. I unset it with

    git config --system --unset credential.helper
    

    and now the credentials are forgotten.

    I faced the same issue as the OP. It was taking my old Git credentials stored somewhere on the system and I wanted to use Git with my new credentials, so I ran the command

    $ git config --system --list
    

    It showed

    credential.helper=manager
    

    Whenever I performed git push it was taking my old username which I set long back, and I wanted to use new a GitHub account to push changes. I later found that my old GitHub account credentials was stored under
    Control PanelUser AccountsCredential ManagerManage Windows Credentials.

    Manage Windows Credentials

    I just removed these credentials and when I performed git push it asked me for my GitHub credentials, and it worked like a charm.

    Try using the below command.

    git credential-manager
    

    Here you can get various options to manage your credentials (check the below screen).

    Enter image description here

    Or you can even directly try this command:

    git credential-manager uninstall
    

    This will start prompting for passwords again on each server interaction request.

    In my case, Git is using Windows to store credentials.

    All you have to do is remove the stored credentials stored in your Windows account:

    Windows credentials menu

    Remove this line from your .gitconfig file located in the Windows’ currently logged-in user folder:

    [credential]
    helper = !\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\"
    

    This worked for me and now when I push to remote it asks for my password again.

    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

    In my case, I couldn’t find the credentials saved in the Windows Credential Manager (Windows 7).

    I was able to reset my credentials by executing

    git config --global credential.helper wincred
    

    It was honestly a hail Mary to see if it would wipe out my credentials and it actually worked.

    In Windows 2003 Server with “wincred”*, none of the other answers helped me. I had to use cmdkey.

    • cmdkey /list lists all stored credentials.
    • cmdkey /delete:Target deletes the credential with “Target” name.

    cmdkey /list; cmdkey /delete:Target

    (* By “wincred” I mean git config --global credential.helper wincred)

    In our case, clearing the password in the user’s .git-credentials file worked for us.

    c:\users\[username]\.git-credentials
    

    Reset of password in Credential manager sorted it out for me

    If you are authenticated using your key pair, you can deleting or moving your private key, or stopping the key agent and trying.

    Git Baby is a git and github fan, let's start git clone.