gpt4 book ai didi

go - 如何将 go get 与私有(private) github 企业服务器一起使用?

转载 作者:IT王子 更新时间:2023-10-29 01:12:17 26 4
gpt4 key购买 nike

我们通过 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

最佳答案

get 命令通过使用 -insecure 标志支持使用 http,如下所示:

go get -insecure privateserver.com/path/to/myproject.git

默认为安全 HTTPS,以防止中间人攻击,如 Git Issue 中所述。 .

关于go - 如何将 go get 与私有(private) github 企业服务器一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48414157/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com