我们通过 VPN 使用 github 企业服务器。
如果我输入:
go get privateserver.com/path/to/myproject.git
我得到这个结果:
package privateserver.com/path/to/myproject.git: cannot download, privateserver.com/path/to/myproject uses insecure protocol
或者删除我得到的 .git 后缀:
package privateserver.com/path/to/myproject: unrecognized import path "privateserver.com/path/to/myproject" (parse https://privateserver.com/path/to/myproject?go-get=1: no go-import meta tags ())
谷歌搜索似乎有很多类似的问题,但没有找到真正有效的答案。
我真正想要结束的是 docker 构建的自动化。在我的 docker 文件中,我需要 go get。但我无法将凭据存储在 docker 文件中。
注意: --insecure 不起作用。见问题底部。
刚刚尝试使用 -insecure -v 选项进行获取。我得到以下输出:
matthewh@xen:~/go/src/$ go get -insecure -v privateserver.com/path/to/myproject.git
# cd .; git ls-remote git://privateserver.com/path/to/myproject
fatal: remote error:
GitHub private mode is enabled. Git protocol is disabled. Use authenticated http or ssh access instead.
# cd .; git ls-remote https://privateserver.com/path/to/myproject
fatal: could not read Username for 'https://privateserver.com': terminal prompts disabled
# cd .; git ls-remote http://privateserver.com/path/to/myproject
fatal: could not read Username for 'https://privateserver.com': terminal prompts disabled
# cd .; git ls-remote git+ssh://privateserver.com/path/to/myproject
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://privateserver.com/path/to/myproject
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
privateserver.com/path/to/myproject.git (download)
# cd .; git clone privateserver.com/path/to/myproject /home/matthewh/go/src/privateserver.com/path/to/myproject.git
fatal: repository 'privateserver.com/path/to/myproject' does not exist
package privateserver.com/path/to/myproject.git: exit status 128