![](/img/trans.png)
[英]How do I setup Carthage to use my own Frameworks that are in private repository like Stash (Bitbucket)?
[英]How do I use Go with Bitbucket private repositories?
我們正在使用私有 Bitbucket 存儲庫來管理我們的 Go 庫。 通過使用insteadOf
的git
配置,如本Stackoverflow 答案中所述,我們有一個工作構建到 Go 版本 1.12。 版本 1.13 和 1.14 不再工作。 我們看到這樣的錯誤:
$ go vet ./...
go: downloading bitbucket.org/travelloapp/golibs v1.0.42
usercache/usercache.go:6:2: bitbucket.org/travelloapp/golibs@v1.0.42: verifying module: bitbucket.org/travelloapp/golibs@v1.0.42: reading https://sum.golang.org/lookup/bitbucket.org/travelloapp/golibs@v1.0.42: 410 Gone
server response:
not found: bitbucket.org/travelloapp/golibs@v1.0.42: reading https://api.bitbucket.org/2.0/repositories/travelloapp/golibs?fields=scm: 403 Forbidden
server response: Access denied. You must have write or admin access.
Go FAQ 建議設置curl
的~/.netrc
文件。 我已經做到了,使用 Bitbucket 的“應用程序密碼”功能。 它不會改變結果。 我添加了bitbucket.org
和api.bitbucket.org
作為主機名。
我可以直接用curl
測試文件設置是否正確:
$ curl -n https://api.bitbucket.org/2.0/repositories/travelloapp/golibs?fields=scm
{"scm": "git"}
記錄在案:盡管出現了 Bitbucket 錯誤消息。 存儲庫讀取權限似乎是唯一需要的權限,盡管我也嘗試過啟用所有權限。
我錯過了什么嗎? 為什么適用於 Go 1.12 的方法不再適用於更高版本?
我目前正在使用:
$ go version
go version go1.14.2 linux/amd64
$ git version
git version 2.17.1
$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
當 Go 1.13 發布時,我們首先遇到了這個問題,目前我們仍然將所有環境都保留在 1.12 上。
由於 go@1.13 具有類似於以前版本的行為,您需要為私有存儲庫設置GOPRIVATE環境變量
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.