【问题标题】:How to pass password to Git command from a batch file如何从批处理文件将密码传递给 Git 命令
【发布时间】:2018-08-01 14:23:37
【问题描述】:

我有一个带有以下脚本的简单批处理文件“clone.bat”。

cd %1 

c:\Program Files\Git\git-cmd.exe" git clone %2 --branch %3

exit

在运行批处理文件时,我传递了 4 个参数。 %1:本地 repo 路径,%2:远程 repo 路径,%3:分支名称,%4 作为密码

我希望当 Git 命令运行时它应该接受 %4 作为密码。但是,它会即时询问我需要避免的密码。

我只设置了 https 身份验证,不使用 SSH。

【问题讨论】:

标签: git batch-file parameter-passing git-clone


【解决方案1】:

在 Windows 上,您不需要密码,因为 Git 默认会在 Windows 凭据管理器中查找它:

git config credential.helper

所以请仔细检查那里是否已经输入了密码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-19
    • 2018-06-20
    • 1970-01-01
    • 2015-08-30
    • 1970-01-01
    • 1970-01-01
    • 2013-08-30
    • 1970-01-01
    相关资源
    最近更新 更多