在 gitlab-ci 的 windows gitlab runner 中使用外部 git-lfs 服务器?
Using external git-lfs server in gitlab-ci on a windows gitlab runner?
我正在尝试使用外部 git-lfs 服务器在 windows gitlab 运行ner 上执行作业 运行ning(其中在我的控制之下)。使用的 git-lfs 服务器仅提供 HTTPS 身份验证(不能选择 SSH)。出于安全原因,我不想将我的凭据提交到文件 .lfsconfig.
对于 Linux,我找到了这个 answer 并根据我的目的对其进行了调整:
git config --global credential.mydomain.helper '!f() { echo "username=${GIT_LFS_USER}"; echo "password=${GIT_LFS_PASSWORD}"; }; f'
我尝试在 windows gitlab-运行ner 上进行配置(config.toml 中的 pre_clone_script 选项),但是我没有无法让它工作(我从 lfs 服务器获得授权被拒绝)并且我不确定这是否可以工作,因为据我了解 Windows git 使用 Windows默认情况下的凭据管理器。
如何向 运行 gitlab-ci 作业提供外部 git-lfs 服务器的凭据 Windows gitlab-运行ner?
我设法在 windows gitlab runner 的配置文件 config.toml
中使用此语法使其工作(替换 myusername
、myurl
和 mypassword
与真正的字符串):
pre_clone_script="""git config --global credential.https://myurl.com.username "myusername"
git config --global "credential.https://myurl.com.helper" '!f() { echo password="mypassword"; }; f'
"""
为了让它更简洁,可以使用 pre_clone_script="Invoke-Command $CI_PRE_CLONE_SCRIPT"
并在每个 gitlab 的项目配置中定义 CI_PRE_CLONE_SCRIPT
。
我正在尝试使用外部 git-lfs 服务器在 windows gitlab 运行ner 上执行作业 运行ning(其中在我的控制之下)。使用的 git-lfs 服务器仅提供 HTTPS 身份验证(不能选择 SSH)。出于安全原因,我不想将我的凭据提交到文件 .lfsconfig.
对于 Linux,我找到了这个 answer 并根据我的目的对其进行了调整:
git config --global credential.mydomain.helper '!f() { echo "username=${GIT_LFS_USER}"; echo "password=${GIT_LFS_PASSWORD}"; }; f'
我尝试在 windows gitlab-运行ner 上进行配置(config.toml 中的 pre_clone_script 选项),但是我没有无法让它工作(我从 lfs 服务器获得授权被拒绝)并且我不确定这是否可以工作,因为据我了解 Windows git 使用 Windows默认情况下的凭据管理器。
如何向 运行 gitlab-ci 作业提供外部 git-lfs 服务器的凭据 Windows gitlab-运行ner?
我设法在 windows gitlab runner 的配置文件 config.toml
中使用此语法使其工作(替换 myusername
、myurl
和 mypassword
与真正的字符串):
pre_clone_script="""git config --global credential.https://myurl.com.username "myusername"
git config --global "credential.https://myurl.com.helper" '!f() { echo password="mypassword"; }; f'
"""
为了让它更简洁,可以使用 pre_clone_script="Invoke-Command $CI_PRE_CLONE_SCRIPT"
并在每个 gitlab 的项目配置中定义 CI_PRE_CLONE_SCRIPT
。