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

后端 未结 12 1743
我寻月下人不归
我寻月下人不归 2020-11-28 00:42

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

相关标签:
12条回答
  • 2020-11-28 00:56

    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

    0 讨论(0)
  • 2020-11-28 00:57

    A similar error is 'credential-wincred' is not a git command

    The accepted and popular answers are now out of date...

    wincred is for the project git-credential-winstore which is no longer maintained.

    It was replaced by Git-Credential-Manager-for-Windows maintained by Microsoft open source.

    Download the release as zip file from link above and extract contents to

    \cygwin\usr\libexec\git-core
    

    (or \cygwin64\usr\libexec\git-core as it may be)

    Then enable it, (by setting the global .gitconfig) - execute:

    git config --global credential.helper manager
    

    How to use

    No further config is needed.

    It works [automatically] when credentials are needed.

    For example, when pushing to Azure DevOps, it opens a window and initializes an oauth2 flow to get your token.

    ref:

    • https://github.com/babun/babun/issues/318

    • https://github.com/Microsoft/Git-Credential-Manager-for-Windows#installation-in-an-msys2-environment

    0 讨论(0)
  • 2020-11-28 00:58

    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}

    0 讨论(0)
  • 2020-11-28 00:58

    I realize I'm a little late to the conversation, but I encountered the exact same issue In my git config I had two entries credentials…

    In my .gitconfig file

    [credential]
    helper = cached
    [credentials]
    helper = wincred
    

    The Fix: Changed my .gitconfig file to the settings below

    [credential]
    helper = wincred
    [credentials]
    helper = wincred
    
    0 讨论(0)
  • 2020-11-28 01:00

    We had the same issue with our Azure DevOps repositories after our domain changed, i.e. from @xy.com to @xyz.com. To fix this issue, we generated a fresh personal access token with the following permissions:

    Code: read & write Packaging: read

    Then we opened the Windows Credential Manager, added a new generic windows credential with the following details:

    Internet or network address: "git:{projectname}@dev.azure.com/{projectname}" - alternatively you should use your git repository name here.
    User name: "Personal Access Token"
    Password: {The generated Personal Access Token}

    Afterwards all our git operations were working again. Hope this helps someone else!

    0 讨论(0)
  • 2020-11-28 01:15

    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:

    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.

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