git: 'credential-cache' is not a git command

225,116

Solution 1

From a blog I found:

This [git-credential-cache] doesn’t work for Windows systems as git-credential-cache communicates through a Unix socket.

Git for Windows

Since msysgit has been superseded by Git for Windows, using Git for Windows is now the easiest option. Some versions of the Git for Windows installer (e.g. 2.7.4) have a checkbox during the install to enable the Git Credential Manager. Here is a screenshot:

screenshot of Git For Windows 2.7.4 install wizard

Still using msysgit? For msysgit versions 1.8.1 and above

The wincred helper was added in msysgit 1.8.1. Use it as follows:

git config --global credential.helper wincred

For msysgit versions older than 1.8.1

First, download git-credential-winstore and install it in your git bin directory.

Next, make sure that the directory containing git.cmd is in your Path environment variable. The default directory for this is C:\Program Files (x86)\Git\cmd on a 64-bit system or C:\Program Files\Git\cmd on a 32-bit system. An easy way to test this is to launch a command prompt and type git. If you don't get a list of git commands, then it's not set up correctly.

Finally, launch a command prompt and type:

git config --global credential.helper winstore

Or you can edit your .gitconfig file manually:

[credential]
    helper = winstore

Once you've done this, you can manage your git credentials through Windows Credential Manager which you can pull up via the Windows Control Panel.

Solution 2

Looks like git now comes with wincred out-of-the-box on Windows (msysgit):

git config --global credential.helper wincred

Reference: https://github.com/msysgit/git/commit/e2770979fec968a25ac21e34f9082bc17a71a780

Solution 3

First run git config --global credential.helper wincred

Then go to: CONTROL PANEL\CREDENTIAL MANAGER\WINDOWS CREDENTIAL\GENERIC CREDENTIAL

then click in add a credential in Internet or network address: add git:https://{username}.github.com

User: {name}

Password: {Password}

Solution 4

I faced this problem while using AptanaStudio3 on windows7. This helped me:

git config --global credential.helper wincred

Code taken from here

Solution 5

First find the version you are using for GIT.

using this command : git --version

if you have a newer version than 1.7.10.

Then simply use this this command.

Windows:

git config --global credential.helper wincred

MAC

git config --global credential.helper osxkeychain

Reference

Share:
225,116

Related videos on Youtube

Big McLargeHuge
Author by

Big McLargeHuge

Updated on January 13, 2022

Comments

  • Big McLargeHuge
    Big McLargeHuge about 2 years

    I followed these instructions to the letter, including the part about password caching. It seems like the instructions are wrong, because every time I git push origin master I get this error:

    git: 'credential-cache' is not a git command. See 'get --help'.
    

    ... at which point I am forced to enter my username and password. After doing so, I am presented with the same error message again, followed by the output from git push.

    Here is the contents of my .gitconfig file:

    [user]
        name = myusername
        email = [email protected]
    [credential]
        helper = cache
    

    To be clear, after I installed Git and ran Git Bash, here is exactly what I typed:

    git config --global user.name "myusername"
    git config --global user.email "[email protected]"
    git config --global credential.helper cache
    

    Please help. This is so frustrating!

    • Wallace Kelly
      Wallace Kelly about 10 years
      To remove the message, "git: 'credential-cache' is not a git command.", run "git config --global --unset credential.helper", then you can follow the instructions below.
    • Web_Designer
      Web_Designer over 9 years
      @Wally +1 Thanks, your command worked for me only after removing --global.
  • ruruskyi
    ruruskyi over 11 years
    gitcredentialstore.codeplex.com contains FAQ. It helped me to install winstore successfully. Binary crashes unless you run it from git-bash.
  • Malachi
    Malachi over 10 years
    FYI I had to install with explicit admin rights. Without it, I was getting error "git: 'credential-winstore' is not a git command. See 'git --help'". My .gitconfig now looks a bit different also, with the [credential line] having "helper = !'C:\\Users\\Malachi\\AppData\\Roaming\\GitCredStore\\git-cr‌​edential-winstore.ex‌​e''
  • Andrew
    Andrew over 10 years
    mine throws an unhandled exception and dies -- System.Diagnostics.Process.StartWithShellExecuteEx(ProcessSt‌​artInfo startInfo)
  • Yogesh Jindal
    Yogesh Jindal over 10 years
    I had to follow the step on this link to completely get it working: stackoverflow.com/questions/13107833/…
  • Domi
    Domi over 10 years
    Is there a reason as to why they would use Unix sockets in a multi-platform application? And if so, why does git-credential-winstore does not ship with the Windows version of Git by default?
  • Chris McKenzie
    Chris McKenzie over 10 years
    The git-credential-winstore tool is not working for me. It used to, but suddenly I'm getting prompted all over the place. I've checked .git-config and the Windows Credential Manager and everything is there that should be. It's simply not working and I really don't have any idea why. :(
  • nimish
    nimish almost 10 years
    This has been essentially superseded by the wincred manager included with msysgit.
  • palswim
    palswim over 8 years
    If you are using git through cygwin, you can place git-credential-winstore in the same directory as your git executable (probably /bin).
  • Casey Murray
    Casey Murray about 8 years
    Credential Manager is in User Accounts and Family Safety in Windows 7
  • Buttle Butkus
    Buttle Butkus almost 8 years
    How do I update these settings if I've already installed without selecting the right option? Do I have to reinstall at that point?
  • Nate Cook
    Nate Cook almost 8 years
    @ButtleButkus In that case I believe you'll just execute git config --global credential.helper wincred at the command line. (This depends on which version of git you have installed of course.)
  • Buttle Butkus
    Buttle Butkus almost 8 years
    @NateCook I decided to update to latest version for windows, apparently 2.8.2. Mine was 2.7-ish from last October. So I chose the correct settings this time but I'm getting this error when running git fetch: "git: 'credential-cache' is not a git command. See 'git --help'."
  • Buttle Butkus
    Buttle Butkus almost 8 years
    I am still getting git: 'credential-cache' is not a git command. even after upgrading to version 2.8.2 on Windows, even though the credential cache is working! I probably created this problem by using some git config command before.
  • Nate Cook
    Nate Cook almost 8 years
    @ButtleButkus Do you by chance have multiple versions of git installed? (Maybe check the path with where git at the command line.) Also check the answers to this related question to see if it helps: stackoverflow.com/questions/20060572/…
  • Gordolio
    Gordolio over 7 years
    This is the answer I was looking for. Microsoft has started maintaining this project. It stores the passwords in the windows credential store.
  • SadBunny
    SadBunny over 7 years
    THANK YOU! It took me an hour to find out how to fix my Windows Credential Manager after changing my domain password. Holy moly, what a maze.
  • Jeroen Wiert Pluimers
    Jeroen Wiert Pluimers over 6 years
    %windir%\explorer.exe shell:::{1206F5F1-0569-412C-8FEC-3204630DFB70} from the console will start the Credential Manager as well.
  • Diallo
    Diallo over 6 years
    Thanks, my issue is fixed :)
  • Johann
    Johann about 5 years
    @ButtleButkus git config alters either ~/.gitconfig or the repo-local .git/config, depending on whether the --global flag was used. Look at those two files for anything related to credentials.
  • Ekaba Bisong
    Ekaba Bisong over 3 years
    On Mac. Do git config --global credential.helper osxkeychain
  • Jay
    Jay about 3 years
    What about Azure git repo? I only have the clone URL as https://<user>@dev.azure.com/<my-org>/<azure-project>/_git/<‌​repo-name>. When I enter this as Internet or web address, it is invalid.
  • Jay
    Jay about 3 years
    I figured it out^^. In case of Azure repos, we can use either HTTPS or SSH connection. I had to configure git://<org-name>@dev.azure.com/<org-name> as Internet address, org-name as username and PAT token as password. Then, I had to execute $ git config --global credential.helper wincred to set proper credential helper.
  • Xaser
    Xaser almost 3 years
    Note that this is not as secure as the in-memory cache. also the 'wincred' option is outdated.
  • A T
    A T almost 3 years
    This was answered 7 years ago. Not sure what the current state of msysgit is
  • andreagalle
    andreagalle over 2 years
    What about Linuxxxxxxxxx ?
  • Tony Hopkinson
    Tony Hopkinson about 2 years
    This worked for me except I had to add --replace-all as well as I had multiple credential.helper entries in my config.

Related