首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Windows批处理脚本自动缓存git凭据?

从Windows批处理脚本自动缓存git凭据?
EN

Stack Overflow用户
提问于 2014-03-08 09:51:38
回答 1查看 835关注 0票数 1

这是我第一个正确的Windows批处理脚本之一;所以请善意:

代码语言:javascript
复制
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

不幸的是,脚本的下一行(它使用git)给了我这个错误:

致命的:‘凭证-winstore’似乎是一个git命令,但我们无法执行它。也许git-凭证-酒庄坏了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-08 11:10:55

看起来git现在提供了wincred开箱即用的Windows操作系统(msysgit):

代码语言:javascript
复制
git config --global credential.helper wincred

参考https://github.com/msysgit/git/commit/e2770979fec968a25ac21e34f9082bc17a71a780

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22267764

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档