سؤال

This is one of my first proper Windows batch scripts; so please be kind:

set /p GIT_CACHE="Cache git credentials?: " %=%
if /i {%GIT_CACHE%}=={y} (goto :cache)
if /i {%GIT_CACHE%}=={yes} (goto :cache)
if /i {%GIT_CACHE%}=={[yes]} (goto :cache)
goto :skip_cache
:cache
for %%X in (git-credential-winstore.exe) do (set FOUND2=%%~$PATH:X)
if NOT DEFINED FOUND2 (
    curl -o git-credential-winstore.exe "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=gitcredentialstore&DownloadId=672532&FileTime=130119839935000000&Build=20885"
    gitcreds.exe -s
    curl -O "https://github.com/downloads/anurse/git-credential-winstore/git-credential-winstore.exe" -k
    if exist (C:\Progra~2\Git\libexec) (
        copy git-credential-winstore.exe "C:\Progra~2\Git\libexec\git-core")
    if exist (C:\Progra~1\Git\libexec) (
        copy git-credential-winstore.exe "C:\Progra~1\Git\libexec\git-core"))
git config --global credential.helper winstore
:skip_cache

Unfortunately the next line of the script (which uses git) gives me this error:

fatal: 'credential-winstore' appears to be a git command, but we were not able to execute it. Maybe git-credential-winstore is broken?

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top