我正在通过将其替换为私有(private)存储库来安装tensorflow。它不会安装,因为它说它无法读取我的私有(private) gitlab 的用户详细信息。我已在 git config 中将 https 替换为 ssh,并尝试启用命令提示符。看来验证步骤失败。
go mod download github.com/tensorflow/tensorflow
go: git.myrepos.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d5a1b0bba6baa7b3b9baa295a3e4fbe5fbe5" rel="noreferrer noopener nofollow">[email protected]</a>: verifying go.mod: git.myrepos.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="abdfcec5d8c4d9cdc7c4dcebdd9a859b859b" rel="noreferrer noopener nofollow">[email protected]</a>/go.mod: reading https://sum.golang.org/lookup/git.myrepos.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6216070c110d10040e0d152214534c524c52" rel="noreferrer noopener nofollow">[email protected]</a>: 410 Gone
server response:
not found: git.myrepos.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d3a7b6bda0bca1b5bfbca493a5e2fde3fde3" rel="noreferrer noopener nofollow">[email protected]</a>: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/2658c7dea94643a56da034a91ab984d322bf101412d6039a91e73001beedffd2: exit status 128:
fatal: could not read Username for 'https://git.myrepos.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
还有我的 go.mod
go 1.18
replace (
github.com/tensorflow/tensorflow => git.myrepos.com/team/tensorflow v1.0.0
)
require (
github.com/tensorflow/tensorflow v0.0.0-00010101000000-000000000000
)
这是我的 .gitconfig
➜ tensorflow cat /Users/myuser/.gitconfig
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = myuser
email = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7815010d0b1d0a3815010a1d08170b4a561b1715" rel="noreferrer noopener nofollow">[email protected]</a>
[url "ssh://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="24434d5064434d500a495d5641544b570a474b49" rel="noreferrer noopener nofollow">[email protected]</a>/"]
insteadOf = https://git.myrepos.com/
[core]
editor = nano
[url "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3b5c524f7b5c524f575a5915585456" rel="noreferrer noopener nofollow">[email protected]</a>:"]
insteadOf = https://gitlab.com/
insteadOf = https://gitlab.com/
我也尝试过这个:
export GIT_TERMINAL_PROMPT=1
env GIT_TERMINAL_PROMPT=1 go get github.com/tensorflow/tensorflow/tensorflow/go
更新:
GIT_TERMINAL_PROMPT=1 GIT_TRACE=1 GIT_CURL_VERBOSE=1 go get github.com/tensorflow/tensorflow/tensorflow/go
go: github.com/tensorflow/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f581909b869a8793999a82b583c5dbc5dbc5d8c5c5c5c4c5c4c5c4c5c5c5c5c5c5d8c5c5c5c5c5c5c5c5c5c5c5c5" rel="noreferrer noopener nofollow">[email protected]</a> (replaced by git.myrepo.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7d0918130e120f1b11120a3d0b4c534d534d" rel="noreferrer noopener nofollow">[email protected]</a>): verifying go.mod: git.myrepo.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7501101b061a0713191a023503445b455b45" rel="noreferrer noopener nofollow">[email protected]</a>/go.mod: reading https://sum.golang.org/lookup/git.myrepo.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2054454e534f52464c4f576056110e100e10" rel="noreferrer noopener nofollow">[email protected]</a>: 410 Gone
server response:
not found: git.myrepo.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8cf8e9e2ffe3feeae0e3fbccfabda2bca2bc" rel="noreferrer noopener nofollow">[email protected]</a>: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/2658c7dea94643a56da034a91ab984d322bf101412d6039a91e73001beedffd2: exit status 128:
fatal: could not read Username for 'https://git.myrepo.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
添加更多上下文。看起来输出是 https://sum.golang.org/lookup/git.myrepo.com/tream/[email protected] 的输出:
请注意,出于隐私目的,我替换了真实的 URL
not found: git.myrepo.com/team/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="483c2d263b273a2e24273f083e7966786678" rel="noreferrer noopener nofollow">[email protected]</a>: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/2658c7dea94643a56da034a91ab984d322bf101412d6039a91e73001beedffd2: exit status 128:
fatal: could not read Username for 'https://git.myrepo.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
我不明白为什么它会尝试验证我的包裹或如何避免这种情况。显然只有我可以访问它
最佳答案
通过导出此环境变量来解决:
GOPRIVATE=git.myrepo.com/team
来自 go doc https://pkg.go.dev/cmd/go#hdr-Configuration_for_downloading_non_public_code
关于go - 由于验证错误,无法安装替换的 go 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72216723/