簡體   English   中英

在 windows gitlab 跑步者的 gitlab-ci 中使用外部 git-lfs 服務器?

[英]Using external git-lfs server in gitlab-ci on a windows gitlab runner?

我正在嘗試將外部 git-lfs 服務器用於在 windows gitlab 跑步者(由我控制)上運行的作業。 使用的 git-lfs 服務器僅提供 HTTPS 身份驗證(SSH 不是一個選項)。 出於安全原因,我不想將我的憑據提交到 file.lfsconfig。

對於 Linux,我找到了這個答案並根據我的目的對其進行了調整:

git config --global credential.mydomain.helper '!f() { echo "username=${GIT_LFS_USER}"; echo "password=${GIT_LFS_PASSWORD}"; }; f'

我嘗試在使用的 windows gitlab-runner 上配置它(config.toml 中的 pre_clone_script 選項),但是我沒有設法讓它工作(我從 lfs 服務器獲得授權被拒絕),我不確定這可以工作,因為據我了解 Windows git 默認使用 Windows 憑據管理器。

如何提供外部 git-lfs 服務器的憑據以在 Windows gitlab-runner 上運行 gitlab-ci 作業?

我設法在 windows gitlab runner 的配置文件config.toml中使用此語法使其工作(用真實字符串替換myusernamemyurlmypassword ):

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM