这个问题在这里已经有了答案:
What's the proper way to "go get" a private repository?
(17 个回答)
2年前关闭。
我正在尝试将私有(private) gitlab 存储库导入到我的 Go 代码中。
我想使用用户访问 token 进行身份验证。有没有一种方法可以在导入命令中传递访问 token 。
我尝试在 import 命令中使用基本的 oauth2 url,但 import 命令只接受一个路径。
最佳答案
你可以运行命令
git config --global url.git@gitlab.com:.insteadOf https://gitlab.com/
再试一次,它会使用你的 git 凭证与 gitlab 一起工作。
例如,您的存储库位于 https://gitlab.com/yourname/hello
你跑
go get gitlab.com/yourname/hello
关于go - 无法导入私有(private) gitlab 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58724470/