【发布时间】:2022-06-16 15:10:38
【问题描述】:
我正在尝试通过将 tensorflow 替换为私有仓库来安装它。它不会安装,因为它说它无法读取我的私人 gitlab 的用户详细信息。我已经在 git config 中用 ssh 替换了 https,还尝试启用命令提示符。看起来验证步骤失败了。
go mod download github.com/tensorflow/tensorflow
go: git.myrepos.com/team/tensorflow@v1.0.0: verifying go.mod: git.myrepos.com/team/tensorflow@v1.0.0/go.mod: reading https://sum.golang.org/lookup/git.myrepos.com/team/tensorflow@v1.0.0: 410 Gone
server response:
not found: git.myrepos.com/team/tensorflow@v1.0.0: 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 = myuser@myrepos2.com
[url "ssh://git@git.myrepos.com/"]
insteadOf = https://git.myrepos.com/
[core]
editor = nano
[url "git@gitlab.com:"]
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/tensorflow@v0.0.0-00010101000000-000000000000 (replaced by git.myrepo.com/team/tensorflow@v1.0.0): verifying go.mod: git.myrepo.com/team/tensorflow@v1.0.0/go.mod: reading https://sum.golang.org/lookup/git.myrepo.com/team/tensorflow@v1.0.0: 410 Gone
server response:
not found: git.myrepo.com/team/tensorflow@v1.0.0: 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/tensorflow@v1.0.0的输出:
请注意,出于隐私目的,我替换了真实 URL
not found: git.myrepo.com/team/tensorflow@v1.0.0: 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.
我不明白为什么它会尝试验证我的包裹或如何避免这种情况。显然只有我可以访问它
【问题讨论】:
-
尝试在
GIT_TRACE=1和GIT_CURL_VERBOSE=1下运行。它是否使 Git 所做的更清楚?是否调用了 Git? -
(虽然我们在这里,你不需要在最后一个命令中使用
env。如果环境变量是exported,那么所有进程都在shell中启动,看它,所以不需要特殊的舞蹈:一个普通的go get ...调用会看到那个变量。另一方面,不需要export一个环境变量,也不需要使用env:shell允许使用VAR1=value1 [VAR2=value2 ...] command调用进程,在这种情况下,运行command的进程(并且只有这个进程)会看到这些变量设置。)老实说,我知道没有令人信服的理由来运行env。 -
更新结果
-
可以手动拨打
git ls-remote -q https://git.myrepos.com/path/to/the/repo吗?它是否会询问有关禁用终端提示的相同问题?我觉得奇怪的是,即使在GIT_TRACE=1下,我在您的输出中也看不到任何类似 Git 跟踪的内容。 -
另外,如果您使用重新映射的 URL (
ssh://git@...) 执行git ls-remote -q ...会发生什么?
标签: go go-modules