git - “go get”无法下载 go 包,托管在 Github Entreprise 上的 git 存储库(在 VPN 之后)
问题描述
我正在尝试下载 Entreprise Github 上的 Go 包。
值得注意的是,该域在 VPN 之外不可见,但我已连接到该 VPN。
我可以https://github.mydomain.com/some_repository
用浏览器浏览,但是我需要登录。
$ go get -v github.mydomain.com/some_repository
get "github.mydomain.com/some_repository": found meta tag get.metaImport{Prefix:"github.mydomain.com/some_repository", VCS:"git", RepoRoot:"https://github.mydomain.com/some_repository.git"} at //github.mydomain.com/some_repository?go-get=1
go: downloading github.mydomain.com/some_repository v0.0.0
go get github.mydomain.com/some_repository: github.mydomain.com/some_repository@v0.0.0: verifying module: github.mydomain.com/some_repository@v0.0.0: reading https://sum.golang.org/lookup/github.mydomain.com/some_repository@v0.0.0: 410 Gone
server response: not found: github.mydomain.com/some_repository@v0.0.0: unrecognized import path "github.mydomain.com/some_repository": https fetch: Get "https://github.mydomain.com/some_repository?go-get=1": dial tcp: lookup github.mydomain.com on 8.8.8.8:53: no such host
我最初认为这是由于命令行工具没有访问令牌,因为浏览器可以访问但不能访问go get
. 我在 Entreprise Github 上生成了一个令牌,并尝试通过以下方式解决此问题:
git config --local http.extraheader "PRIVATE-TOKEN: <token>"
git config --local url."git@github.mydomain.com:".insteadOf "https://github.mydomain.com/"
正如这里所解释的,但这并没有帮助。
的存在lookup github.mydomain.com on 8.8.8.8:53: no such host
可能是一个线索,因为 8.8.8.8 是 google 的 DNS,并且由于 mydomain.com 仅存在于 VPN 上,所以这不可能工作。如果与 VPN 断开连接,则表明 mydomain.com 不存在。我不确定为什么go get
会使用 8.8.8.8 作为 DNS。
scutil --dns | grep 'nameserver\[[0-9]*\]'
列出了几个 DNS 服务器,其中没有一个是 8.8.8.8,所以也许是go get
硬编码的?
解决方案
看来设置环境变量GOPRIVATE=*.mydomain.com
可以解决这个问题。
推荐阅读
- android - 关闭应用程序后如何进入主屏幕,重新启动应用程序后直接将我带到登录页面
- vba - 不支持地图图表的 VBA“ClearToMatchStyle”方法(可能的错误)
- javascript - 我创建了一个密码框,即使我输入了正确的密码,它也显示错误
- php - 如何在php中强制/关闭套接字连接
- laravel - 在数据库中插入芯片并在 Laravel 8 和 Materialize CSS 中从数据库中显示它
- rust - 如何在 Rust 中为 RNG 函数提供范围?
- entity-framework-core - EF Core-Asp Net Core 一对多关系添加新项目
- javascript - 在播放当前视频时暂停页面上的所有视频
- reactjs - 如何使用道具设置值?
- reactjs - 如何将简单的 CSS 转换为 React 的 makeStyles?