gpt4 book ai didi

git - 如何在 Azure DevOPS 服务器上使用 PAT 克隆 git 存储库

转载 作者:行者123 更新时间:2023-12-05 05:57:16 25 4
gpt4 key购买 nike

您好,我们正在尝试从本地 Azure DevOps 服务器 2020.0.1 克隆一个 git 存储库。我们正在使用下面的命令,但它不起作用。这应该是可能的吗?
我尝试遵循的文档是 this .但是有点不清楚。

git clone https://{an username:yourPAT}@yourURL/yourOrgName/yourProjectName/_git/yourRepoName

然后我们得到一个错误:“fatal: Authentication failed for”
我们还尝试了诸如“yourname:yourPAT”、“yourPAT”、“:yourPAT”、“yourPAT:”之类的变体我们想将 PAT 与 SmartGit 一起使用

然后我们尝试使用提到的其他方法(但是当阅读仅在使用基本身份验证时才需要,我们从未在我们的 ADOS 服务器上启用它,也不是我们 IIS 网站上的身份验证方法:

$MyPat = 'yourPAT'
$B64Pat = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$MyPat"))
git -c http.extraHeader="Authorization: Basic $B64Pat" clone https://{yourURL/yourOrgName/yourProjectName/_git/yourRepoName

这个可以用

我们创建的 PAT 具有所有组织的完整范围和访问权限。
PAT 正在努力添加代理。
我们还可以使用它来访问 RESTAPI(使用 curl 你应该 -u 和随机或空的用户名,所以 bla;yourPAT)。

如有任何建议,我们将不胜感激。

最佳答案

根据您的描述,当您使用basic auth运行git命令时,是可以的。

看来是开启了basic auth

如果为 Azure Devops 服务器启用 IIS 基本身份验证,则 PAT 无效。参见 Enabling IIS Basic Authentication invalidates using Personal Access Tokens .

If you use Git with IIS Basic Authentication, Git breaks because it requires PATs for user authentication. Although we don't recommend you use IIS Basic Authentication, by adding an extra header to Git requests, you can use Git with IIS Basic Authentication:

您可以打开 IIS Manager -> IIS -> Authentication 并检查 Basic Authentication 是否被禁用。

enter image description here

另一方面,您可以从 Credential Manager 中删除与 Azure DevOps Server 相关的凭据:打开 windows 上的控制面板–> 单击用户帐户–> 单击管理您的凭据–>单击 Windows 凭据,找到您的远程 git 存储库的条目–>单击列表中的项目然后选择 Remove–> Finally try to use PAT again to clone a git Repo.

关于git - 如何在 Azure DevOPS 服务器上使用 PAT 克隆 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68862670/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com