[英]Clone git from Azure DevOps Server (on-prem) using access token
I have an Azure DevOps Server instance installed on a Windows Server 2019 machine: https://tfs.acme.com我在 Windows Server 2019 机器上安装了一个 Azure DevOps Server 实例: https ://tfs.acme.com
I'm trying to clone a repository using a personal access token.我正在尝试使用个人访问令牌克隆存储库。 I managed to clone the repository using my NTLM login password, but not using the token ( fatal: Authentication failed
).我设法使用我的 NTLM 登录密码克隆了存储库,但没有使用令牌( fatal: Authentication failed
)。
I enabled all possible scopes when generating the token and it works fine for all API calls I've tried.我在生成令牌时启用了所有可能的范围,它适用于我尝试过的所有 API 调用。
Is there any additional configuration for cloning with token?是否有任何其他配置用于使用令牌进行克隆? Another method that will allow me to use same password for both API and clone?另一种允许我对 API 和克隆使用相同密码的方法? (NTLM password fails on Rest API calls). (NTLM 密码在 Rest API 调用上失败)。
This worked for me: https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Linux#use-a-pat这对我有用: https ://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Linux#use-a -拍
Linux: Linux:
MY_PAT=yourPAT # replace "yourPAT" with ":PatStringFromWebUI"
B64_PAT=$(printf "%s"":$MY_PAT" | base64)
git -c http.extraHeader="Authorization: Basic ${B64_PAT}" clone https://dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
Windows:视窗:
$MyPat = ':PatStringFromWebUI'
$UserName = ':UserNameToUseWithToken'
$B64Pat = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$UserName:$MyPat"))
git -c http.extraHeader="Authorization: Basic $B64Pat" clone https://dev.azure.com/yourOrgName/yourProjectName/_git/yourRepoName
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.