由于go对私有gitlab的仓库支持不好,得使用下面这些步骤

  • 设置git使用 ssh协议 git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"

  • 添加ssh key 到gitlab

    1. ssh-keygen 会生成 id_rsa.pub
    2. cat ~/.ssh/id_rsa.pub 粘贴到gitlab 右上角头像 Setting -> SSH keys,或者打开链接https://gitlab.com/profile/keys
  • 修改 go.mod 添加 replace gitlab.com/YourGroup/SubGroup/Project => gitlab.com/YourGroup/SubGroup/Project.git master

  • 设置noproxy域名 go env -w GONOPROXY=\*\*.gitlab.com\*\*

  • 设置private域名 go env -w GOPRIVATE=\*\*.gitlab.com\*\*

自己搭建的gitlab也是如此

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2021-09-07
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2021-06-07
  • 2022-02-03
  • 2021-08-23
  • 2022-01-04
  • 2022-12-23
  • 2021-11-05
相关资源
相似解决方案