我使用coding.net 创建了私有存储库。
我使用 docker images alpine和centos。
我可以从 docker git.coding.net/alphayan/orionv2.git successful-centos获取,但不能git.coding.net/alphayan/test.git从 docker-alpine获取。它返回一个错误说明:
/go/src # go get -u -v git.coding.net/alphayan/test.git
# cd .; git ls-remote https://git.coding.net/alphayan/test
fatal: could not read Username for 'https://git.coding.net': terminal prompts disabled
# cd .; git ls-remote git+ssh://git.coding.net/alphayan/test
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote ssh://git.coding.net/alphayan/test
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
package git.coding.net/alphayan/test.git: cannot download, git.coding.net/alphayan/test uses insecure protocol
Run Code Online (Sandbox Code Playgroud)
从centos它让我使用用户名和密码:
[root@83fc8067fc95 /]# go get -u -v git.coding.net/alphayan/test.git
Username for 'https://git.coding.net':
Run Code Online (Sandbox Code Playgroud)
最后,我发现它是由 git 的版本、带有 git 1.8.3 的 centos 和带有 git 2.11.0 的 alpine 引起的。
然后我将centos git的版本更改为2.11.0,与alpine相同。我想我可以修改 golang 或 git 源文件来解决这个问题,有人可以帮我吗?觉得~!
发生此错误是因为默认情况下go get 不使用终端输入。GIT_TERMINAL_PROMPT可以通过修改git 2.3 中引入的环境变量来更改此行为。这就是该go get命令在 CentOS 7 (git 1.8) 和 Alpine 3.5 (git 2.11) 中表现不同的原因。
git >= 2.3您可以通过运行go get以下命令来解决该问题:
$ GIT_TERMINAL_PROMPT=1 go get github.com/foo/bar
Username for 'https://github.com':
Run Code Online (Sandbox Code Playgroud)
如果您有多个go get调用,则可以在运行命令之前导出该环境变量:
$ export GIT_TERMINAL_PROMPT=1
$ go get github.com/foo/bar
Username for 'https://github.com':
$ go get github.com/foo/baz
Username for 'https://github.com':
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1366 次 |
| 最近记录: |