![](/img/trans.png)
[英]Is it possible to use pip to install a package from a private GitHub repository?
[英]Can I use pip to install a package from a private VSTS repository?
我想用pip為我的python app安裝一個私有包。
我的包存儲在Azure DevOps (Visual Studio Team Services)上的git倉庫中。
我看到pip支持git ,但我無法確定Azure的URL的可行格式。
我想避開Credential Manager 。 我試過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>
有可能,請查看現有的請求
按此,您需要按照以下步驟,
$(System.AccessToken)
以上是System變量,您可以在此處找到完整的詳細信息
您還可以使用下面的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)"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.