当你写好引入的私有包,执行go mod tidy报错:
Gogs: Repository owner does not exist
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
目前我的两种解决方案:
一、拉群整个包的代码,然后简单粗暴的replace为本项目的同名包目录

module base
go 1.22
require (
git.imooc.com/coding-535/common v0.0.0-20220913123407-af94ee6eb5c3
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
github.com/asim/go-micro/plugins/registry/consul/v3 v3.7.0
github.com/asim/go-micro/plugins/wrapper/ratelimiter/uber/v3 v3.7.0
github.com/asim/go-micro/plugins/wrapper/trace/opentracing/v3 v3.7.0
github.com/asim/go-micro/v3 v3.7.0
github.com/jinzhu/gorm v1.9.16
github.com/opentracing/opentracing-go v1.2.0
google.golang.org/protobuf v1.27.1
k8s.io/api v0.22.4 //其它版本会报错
k8s.io/client-go v0.22.4 //其它版本会报错
)
replace git.imooc.com/coding-535/common v0.0.0-20220913123407-af94ee6eb5c3 => ../common
二、修改GOPRIVATE和git的全局配置
修改go env的GOPRIVATE配置:
go env -w GOPRIVATE=git.imooc.com
注:其他env配置就略过了,本文只写了适合主题的配置。
修改git的全局配置:
git config --global url."git@git.imooc.com:".insteadof https://git.imooc.com/

最低0.47元/天 解锁文章
7411

被折叠的 条评论
为什么被折叠?



