簡體   English   中英

在憑據緩存中臨時存儲git憑據

[英]Temporary store git credentials in credential-cache

我在Carthage ,GitLab CI和我們的內部依賴項方面遇到了一些身份驗證問題。 我們的跑步者很干凈,出於安全考慮,他們的鑰匙串中沒有存儲任何有關GitLab的憑據。

carthage bootstrap在作業中運行時,迦太基使用git credential fill對請求進行身份驗證,在本例中,該請求失敗。

A shell task (/usr/bin/env git fetch --prune --quiet https://gitlab.corp.com/path/to/lib.git refs/tags/*:refs/tags/* +refs/heads/*:refs/heads/* (launched in /Users/x/Library/Caches/org.carthage.CarthageKit/dependencies/lib)) failed with exit code 128:
remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'api' scope for Git over HTTP.
remote: You can generate one at https://gitlab.corp.com/profile/personal_access_tokens
fatal: Authentication failed for 'https://gitlab.corp.com/path/to/lib.git/'

每個作業都會獲得一個作業令牌,並且應該使用該令牌與GitLab進行通信。

如何將用戶名gitlab-ci-token和密碼$CI_JOB_TOKEN臨時插入git憑據緩存存儲區?

如何將用戶名gitlab-ci-token和密碼$ CI_JOB_TOKEN臨時插入git憑據緩存存儲區?

這表明gitlab.corp.com URL現在已經在Windows憑據管理器(由git憑據幫助器使用)中已與用戶名/密碼關聯。

由於憑據管理器只能將一個憑據與一個URL關聯,因此您可能需要切換到沒有令牌限制的SSH方案。
甚至可以通過以下方式自動完成:

git config --global url.ssh://git@gitlab.corp.com/.insteadOf https://gitlab.corp.com/

暫無
暫無

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

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