236

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jez
  • 27,951
  • 32
  • 136
  • 233

19 Answers19

299

OK, I discovered that you need to either avoid checking the "Git Credential Manager" checkbox during the Git for Windows installer, or (after installation) run the Bash shell as Administrator and use git config --edit --system to remove the helper = manager line so that it is no longer registered as a credential helper.

For bonus points, use git config --edit --global and insert:

[core]
    askpass =

To disable the OpenSSH credentials popup too.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jez
  • 27,951
  • 32
  • 136
  • 233
  • 22
    Thanks for you answer. For me, this was the first time to use the editor. If you want to save changes, hit the escape key and type :wq and hit enter (write/save and quit). – Ben Besuijen Aug 08 '16 at 09:27
  • 2
    Many thanks! The credential manager got confused with my work's proxy server and it made working with Sourcetree a nightmare. Disabling it fixed the problem immediately. – Johnny Aug 09 '16 at 18:29
  • 1
    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 '17 at 09:14
  • 69
    Or knock it out with `git config --system --unset credential.helper` – Ben Butzer May 19 '17 at 20:17
  • See also: https://stackoverflow.com/questions/42627269/jenkins-using-git-askpass-to-set-credentials/42636309?noredirect=1#comment76361367_42636309 – Ben Butzer Jun 22 '17 at 13:11
  • Using "Git for Windows (64 bit)", the system config file is at %ProgramFiles%\Git\mingw64\etc\gitconfig and the global config file is at %USERPROFILE%\.gitconfig – cowlinator Oct 23 '17 at 04:40
  • I did uncheck it during install. The stupid thing still started popping up, even though I can't see anything in the config settings that would make it do so. But this fixes it. Thanks! You can also just set it to the empty string directly from the command line: `git config --global core.askpass ''`. @BenButzer In my experience, things keep putting it back. Better to override it to empty in your global config where other tools will (hopefully) not mess with it. – jpmc26 Apr 27 '18 at 21:21
  • 7
    For those using SourceTree make sure that the "system" version of GIT is being used, not the embedded one. `Tools -> Options -> Git`. – Stevanicus May 09 '18 at 11:42
  • The edit commands appear to be the same as "vi". See this for vi command keys: http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/basic/node168.html – mxmoss Oct 26 '18 at 15:44
  • Adding to the chain of woe-resolution. Unsetting `credential.helper` doesn't (no longer?) works. You need to do the following in admin session: `git config --global credential.helper '' ; git config --global core.askpass ''` ; and for good measure, do the same without `--global` in your local dirs in case they were set there too – taifwa Jan 29 '19 at 10:51
  • @BenBesuijen "the editor" is called "vim" – robertspierre Feb 28 '22 at 14:02
  • 2
    @cowlinator My system file was in "C:\Program Files\Git\etc\gitconfig". At least that is what `git config --edit --system` opens anyway. I don't seem to have a gitconfig in %ProgramFiles%\Git\mingw64\etc – Caltor Apr 17 '23 at 13:33
  • @Caltor , yes, me too. It seems to have been changed sometime in the last 8 years. – cowlinator Apr 17 '23 at 23:45
36

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

As of git-credential-manager version 2.2.2 (installed with git version 2.41.0.windows.3), this command has been replaced with git-credential-manager unconfigure [Edit thanks to @wrapperapps]

Ian Mercer
  • 38,490
  • 8
  • 97
  • 133
  • 2
    This just stalls and after I press ctrl-c, spits out this usage: `git credential [fill|approve|reject]` – ScottN May 03 '17 at 14:20
  • 3
    @ScottN you're running `git-credential.exe` but you need to run `git-credential-manager.exe`. – Aidan Ryan Jan 26 '18 at 12:55
  • 1
    as of git-credential-manager version 2.2.2 (installed with git version 2.41.0.windows.3), this command has been replaced with `git-credential-manager unconfigure` – wrapperapps Aug 18 '23 at 15:21
20

Another option I had to use with VSTS:

git config --global credential.modalprompt false

Gazihan Alankus
  • 11,256
  • 7
  • 46
  • 57
Sten Petrov
  • 10,943
  • 1
  • 41
  • 61
  • 3
    Thanks! I found it very useful when using ssh to connect remotely to my production server: I couldn't do a `git pull` because of the WCM shelling out. With this option I enjoy both worlds: WCM when connected physically with the server (or with Remote Desktop), and being able of pulling from a ssh client. – cbuchart Sep 28 '18 at 11:14
13

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://myGithubUsername@github.com/
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) (budget@1.0.0)
λ 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://myGitHubUsername@github.com/
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.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
10

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Martin Ba
  • 37,187
  • 33
  • 183
  • 337
8

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
8

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 menu FileSettingsVersion ControlGit.

  2. Disable Use credential helper:

    Disable "Use credential helper"

  3. Don't forget to press Save.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jura Gorohovsky
  • 9,886
  • 40
  • 46
7

For problems where the tips in previous answers did not solve it:

I use

git credential-manager remove -force
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Max K
  • 106
  • 1
  • 6
7

We struggled with this issue. While we tried to clone code from a Git repository, without prompting (asking) for a Git username and password, it started cloning the code and finally failed due to authentication failed. Even credentials are not set and first time Git clone used.

Resolution: Run the command and it’s perfectly working.

git config --system --unset credential.helper
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rajeev Rathor
  • 1,830
  • 25
  • 20
  • For me, the command needed to be `git config --global --unset credential.helper`: I replaced --system by --global and it worked. – Matt Aug 29 '23 at 07:18
6

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
6

Maybe the problem is Sourcetree.

  1. Go to ToolsOptions

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

  3. Restart Sourcetree!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
hatanooh
  • 3,891
  • 1
  • 14
  • 9
  • Hi @hatonooh. Thanks for the hint, this helped me find the correct solution for me, but was not yours. In Tools / Options : Authentication I removed my account. The next time I pulled my repo I had a prompt for password, which recreated this account. – Jean Lestang Nov 09 '20 at 08:43
2

To prevent the dialog, use git config --global credential.modalPrompt false

That'll drive the queries to the console.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mahdi Afzal
  • 729
  • 10
  • 14
2

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?

Ger Hobbelt
  • 1,126
  • 1
  • 11
  • 16
1

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).

1

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
wanton
  • 98
  • 7
1

You can just delete the Credential Manager.

C:\Users\<USER>\AppData\Local\Programs\Git\mingw64\libexec\git-core
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user3642831
  • 311
  • 3
  • 3
1

I had another problem to set git not prompt for any password, I learned another command line trick one can use for this purpose.

In case you want a temporary solution for the terminal session you work on, this might come in handy:

git -c credential.helper= <rest of the commands>

Yılmaz Durmaz
  • 2,374
  • 12
  • 26
-1

Visual Studio Code: Menu FilePreferencesConfigurationGitHubgitAuthentication: false. Change the repository's protocol from https:// to git:// and use public key authentication for Git.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user61253764
  • 478
  • 5
  • 9
  • This does not match the current version of Visual Studio Code (1.62.3). For instance, "Preferences" does not contain "Configuration" (or anything close to it). Can you add information for later versions of Visual Studio Code? (But ***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today.) – Peter Mortensen Nov 16 '21 at 20:36