[git] How do I disable Git Credential Manager for Windows?

I notice that in the latest version of Git, the default is now to popup a "Git Credential Manager for Windows" dialog instead of prompting me for me password at the Bash prompt every time.

I really hate this behaviour. How can I just disable it and go back to entering the password at the Bash shell every time?

By the way, I don't want Git caching my credentials in any way, whether through Windows credentials or some internal daemon. I want to disable all credential caching.

This question is related to git bash

The answer is


I had had that problem, and I've only removed the git-credential-manager.exe file from:

C:\Program Files\Git\mingw64\libexec\git-core

Under "user" folder c://user, look at ".gitconfig" file then remove the http and proxy line.


If you notice the credential manager UI popping up when you use a JetBrains IDE (such as IntelliJ IDEA, PhpStorm, WebStorm, PyCharm, Rider, RubyMine, Android Studio, or Goland), do this:

  1. In your IDE, go to File | Settings | Version Control | Git.

  2. Disable Use credential helper: Disable "Use credential helper"

  3. Don't forget to press Save.


I was able to uninstall the Git Credential Manager for Windows using the uninstall option:

git-credential-manager.exe uninstall

Run this command in C:\Program Files\Git\mingw64\libexec\git-core


Use:

C:\Program Files\Git\mingw64\libexec\git-core                                                                       
git credential-manager uninstall --force    

This works on Windows systems. I tested it, and it worked for me.


To prevent the dialog use git config --global credential.modalPrompt false, that'll drive the queries to the console.


In case you do not want to remove or uninstall the credentials manager: see https://serverfault.com/questions/544156/git-clone-fail-instead-of-prompting-for-credentials/1054253#answer-1054253 for the solution that worked for me.

Explanations, etc. in that page (linked to prevent duplicate content in the same website family).


TL;DR: this now sits on top of my automated bash scripts:

# https://serverfault.com/questions/544156/git-clone-fail-instead-of-prompting-for-credentials
export GIT_TERMINAL_PROMPT=0
# next env var doesn't help...
export GIT_SSH_COMMAND='ssh -oBatchMode=yes'
# these should shut up git asking, but only partly: the X-windows-like dialog doesn't pop up no more, but ...
export GIT_ASKPASS=echo
export SSH_ASKPASS=echo
# We needed to find *THIS* to shut up the bloody git-for-windows credential manager: 
# https://stackoverflow.com/questions/37182847/how-do-i-disable-git-credential-manager-for-windows#answer-45513654
export GCM_INTERACTIVE=never

The final nail in the coffin of that credentials manager was the unique bit (GCM_INTERACTIVE) in Martin Ba's answer above: How do I disable Git Credential Manager for Windows?


I struck the same issue on Ubuntu 18.10 (Cosmic Cuttlefish), unable to remove using any normal means. I used git config --global --unset credential.helper, and that seemed to do the trick.


you can just delete the Credential Manager.

C:\Users\<USER>\AppData\Local\Programs\Git\mingw64\libexec\git-core

pretty old topic but this is maybe a help for someone searching for the problem where the above tips does not solved it.

I use

git credential-manager remove -force

Another option I had to use with VSTS:

git config credential.modalprompt false --global


Maybe the problem is Sourcetree.

  1. Go to ToolsOptions

  2. Uncheck "Check default remotes for updates every [10] minutes"

  3. Restart Sourcetree!


I wanted to use the credential manager for normal use, but I have scripts where I obviously do not want any prompts whatsoever from git.exe. This is how I invoke Git from my scripts:

set GIT_TERMINAL_PROMPT=0
git -c core.askpass= -c credential.helper= <command> ...

This way, the script always sees the "correct" no-prompt setting without having to adapt any configuration.

(Git for Windows 2.13.3)


A variation I found that might also come in handy is to set:

set GCM_INTERACTIVE=never
# Or: git config --global credential.interactive never

set GIT_TERMINAL_PROMPT=0
git.exe -c core.askpass= -c credential.helper=manager <command> ...

But note that git.exe -c credential.interactive=never <command> ... does not work (it seems that the -c thing isn't routed through to Git Credential Manager for Windows or whatever).

That way, you can use the GCMfW, but it will never prompt you; it will just lookup the credentials, which can be very helpful in non-interactive environs.


It didn't work for me:

C:\Program Files\Git\mingw64\libexec\git-core
git-credential-manager.exe uninstall

Looking for Git installation(s)...
  C:\Program Files\Git

Updated your /etc/gitconfig [git config --system]
Updated your ~/.gitconfig [git config --global]

Removing from 'C:\Program Files\Git'.
  removal failed. U_U

Press any key to continue...

But with the --force flag it worked:

C:\Program Files\Git\mingw64\libexec\git-core
git credential-manager uninstall --force
08:21:42.537616 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
e
08:21:42.538616 git.c:576               trace: exec: git-credential-manager uninstall --force
08:21:42.538616 run-command.c:640       trace: run_command: git-credential-manager uninstall --force

Looking for Git installation(s)...
  C:\Program Files\Git

Updated your /etc/gitconfig [git config --system]
Updated your ~/.gitconfig [git config --global]


Success! Git Credential Manager for Windows was removed! ^_^

Press any key to continue...

I could see that trace after I run:

set git_trace=1

Also I added the Git username:

git config --global credential.username myGitUsername

Then:

C:\Program Files\Git\mingw64\libexec\git-core
git config --global credential.helper manager

In the end I put in this command:

git config --global credential.modalPrompt false

I check if the SSH agent is running - open a Bash window to run this command

eval "$(ssh-agent -s)"

Then in the computer users/yourName folder where .ssh is, add a connection (still in Bash):

ssh-add .ssh/id_rsa

or

ssh-add ~/.ssh/id_rsa(if you are not in that folder)

I checked all the settings that I add above:

C:\Program Files\Git\mingw64\libexec\git-core
git config --list
09:41:28.915183 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-cor
e
09:41:28.917182 git.c:344               trace: built-in: git config --list
09:41:28.918181 run-command.c:640       trace: run_command: unset GIT_PAGER_IN_USE; LESS=FRX LV=-c less
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
credential.modalprompt=false
credential.username=myGitUsername

And when I did git push again I had to add username and password only for the first time.

git push
Please enter your GitHub credentials for https://[email protected]/
username: myGithubUsername
password: *************
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 316 bytes | 316.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.

Since then using git push, I don't have the message to enter my Git credentials any more.

D:\projects\react-redux\myProject (master -> origin) ([email protected])
? git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 314 bytes | 314.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/myGitUsername/myProject.git
   8d38b18..f442d74  master -> master

After these settings I received an email too with the message:

 A personal access token (git: https://[email protected]/
on LAP0110 at 25-Jun-2018 09:22) with gist and repo scopes was recently added
to your account. Visit https://github.com/settings/tokens for more information.

and if :wq doesn't work like my case use ctrl+z for abort and quit but these will probably make multiple backup file to work with later – Adeem Jan 19 at 9:14

Also be sure to run Git as Administrator! Otherwise the file won't be saved (in my case).