Sco*_*ell 6 git pip azure-devops
我想使用pip为我的python应用安装私有软件包。
我的程序包存储在Azure DevOps(Visual Studio Team Services)上的git仓库中。
我看到git受pip支持,但是我无法确定Azure URL的可行格式。
我想避免使用凭证管理器。我已经尝试了git + ssh(带密钥)和git + https(带个人访问令牌)。
使用Azure / VSTS可以做到这一点吗?
对于上下文,我引用了以下资源:
https://www.revsys.com/tidbits/using-private-packages-python/
这是我的一些尝试:
git+https://myUsername:myAccessToken@myCompany.visualstudio.com/myProject/_git/myPackage.git
git+https://<myAccessToken>@visualstudio.com/<myCompany>/<myProject>.git@<ref>
git+https://<myUsername>:<myAccessToken>@<myCompany>.visualstudio.com/<myteam>/<myProject>.git@<ref>
git+https://<myUsername>:<myAccessToken>@visualstudio.com/<myCompany>/<myProject>.git@<ref>
git+https://<myUsername>:<myAccessToken>@visualstudio.com/<myCompany>/<myProject>.git@<ref>
git+ssh://myCompany@vs-ssh.visualstudio.com:v3/myCompany/<myProject>.git@<ref>
Run Code Online (Sandbox Code Playgroud)
有可能,请查看这个现有的请求
因此,您需要按照以下步骤操作,
$(System.AccessToken)在存储库克隆 URL 之间添加上面是系统变量,您可以在此处找到完整的详细信息
您还可以使用如下所示的 Rest API 来获取访问令牌
$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/build-release/definitions/$($env:SYSTEM_DEFINITIONID)?api-version=2.0"
Write-Host "URL: $url"
$pipeline = Invoke-RestMethod -Uri $url -Headers @{
Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"
}
Write-Host "Pipeline = $($pipeline | ConvertTo-Json -Depth 1000)"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
447 次 |
| 最近记录: |