【发布时间】:2020-09-05 10:43:02
【问题描述】:
由于某些未知原因,我在 Azure DevOps 构建代理上遇到了 git 身份验证问题,身份验证仅适用于 MacPorts 版本的 git:
>/usr/bin/git clone --config "http.sslVerify=false" "https://…:…@…/DefaultCollection/…/_git/…"
Cloning into '…'...
fatal: Authentication failed for 'https://…:…@…/DefaultCollection/…/_git/…/'
>/usr/local/bin/git clone --config "http.sslVerify=false" "https://…:…@…/DefaultCollection/…/_git/…"
Klone nach '…' ...
fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
>/opt/local/bin/git clone --config "http.sslVerify=false" "https://…:…@…/DefaultCollection/…/_git/…"
Klone nach '…' ...
remote: Azure Repos
remote: Found 25399 objects to send. (22 ms)
Empfange Objekte: 100% (25399/25399), 21.80 MiB | 39.24 MiB/s, Fertig.
Löse Unterschiede auf: 100% (17128/17128), Fertig.
我已经尽力让构建代理使用 MacPorts 版本:
但结帐仍然失败:
##[section]Starting: Checkout
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Syncing repository: repository (ExternalGit)
##[command]git version
git version 2.26.2
##[command]git init "/Work/TFS/1/s"
Leeres Git-Repository in /Users/Shared/Work/TFS/1/s/.git/ initialisiert
##[command]git remote add origin https://…/DefaultCollection/…/_git/…
##[command]git config gc.auto 0
##[command]git config --get-all http.https://…/DefaultCollection/…/_git/….extraheader
##[command]git config --get-all http.proxy
##[command]git remote set-url origin https://***:***@…/DefaultCollection/…/_git/…
##[command]git remote set-url --push origin https://***:***@…/DefaultCollection/…/_git/…
##[command]git -c http.sslVerify=false fetch --force --tags --prune --progress --no-recurse-submodules origin
fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
##[warning]Git fetch failed with exit code 128, back off 9.834 seconds before retry.
##[command]git -c http.sslVerify=false fetch --force --tags --prune --progress --no-recurse-submodules origin
fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
##[warning]Git fetch failed with exit code 128, back off 8.115 seconds before retry.
##[command]git -c http.sslVerify=false fetch --force --tags --prune --progress --no-recurse-submodules origin
fatal: Authentifizierung fehlgeschlagen für 'https://…/DefaultCollection/…/_git/…/'
##[error]Git fetch failed with exit code: 128
##[section]Finishing: Checkout
那么如何确保使用了正确的 git 可执行文件?我试图搜索管理结帐的脚本,但无济于事。
更新 1: 我已经卸载了 Brew 版本的 Git,但这只会导致使用 macOS 版本。而且我不能卸载那个。
更新 2: 我放置了一个符号链接 ln -s /opt/local/bin/git /usr/local/bin/git。这确实有效,但这不是最好的解决方法,我想要一个更干净的解决方案。
【问题讨论】:
-
从日志看来,您正在连接到 Azure DevOps 服务器,而不是托管服务。
-
@jessehouwing 是的。请注意,当使用
/opt/local/bin/git时,结帐工作有效。所以这不是一个连接错误。更有可能是 Apple 或 Homebrew 提供的 git 版本存在问题。 MacPorts git 通常是从源代码编译的,因此它可能具有更好的集成性,因此它可以工作。 -
@Martin,看来我们无法将内置任务更改为使用 MacPorts git,我的解决方法如何?对你有帮助吗?
标签: git azure azure-devops build-automation build-agent