• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

golang导入私有仓库报错:“server response: not found:xxx: invalid version: git ls-remote -q origin in xxx“

武飞扬头像
王建文
帮助1

1.问题:go get导入私有仓库报错

➜   go get "devops.gitlab.xxx.com/test/kafka-utils"
go: devops.gitlab.xxx.com/test/kafka-utils@v0.0.1: verifying go.mod: devops.gitlab.xxx.com/testo/kafka-utils@v0.0.1/go.mod: reading https://goproxy.cn/sumdb/sum.golang.org/lookup/devops.gitlab.xxx.com/test/kafka-utils@v0.0.1: 404 Not Found
        server response:
        not found: devops.gitlab.xxx.com/test/kafka-utils@v0.0.1: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/4eca6870c5eba21f85d126a33da76e0445c3741603369eb6c7037cbbb88e9a16: exit status 128:
                fatal: could not read Username for 'https://devops.gitlab.xxx.com': terminal prompts disabled
        Confirm the import path was entered correctly.
        If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

2.尝试过但不生效的方法

首先,已经确认在gitlab上设置过ssh自己设备的public key。

未生效的方法:(这个方法网上给出的最多,但是对我不适用)

git config --global url."ssh://git@devops.gitlab.xxx.com".insteadof "https://devops.gitlab.xxx.com"

3.生效的方法

将GOPRIVATE改为私有仓库的域名

go env -w GOPRIVATE="devops.gitlab.xxx.com"

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgfhjhh
系列文章
更多 icon
同类精品
更多 icon
继续加载