go解决引入私有包报错“Repository owner does not exist“的两种方式

news2024/9/23 19:38:01

当你写好引入的私有包,执行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/   

然后测试,使用go mod tidy 验证:

user模块的go.mod

module git.imooc.com/coding-535/user

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 //其它版本会报错
)

require (
	github.com/Microsoft/go-winio v0.5.0 // indirect
	github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
	github.com/acomagu/bufpipe v1.0.3 // indirect
	github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
	github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
	github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
	github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
	github.com/asim/go-micro/plugins/config/source/consul/v3 v3.0.0-20210904061721-270d910b7328 // indirect
	github.com/beorn7/perks v1.0.1 // indirect
	github.com/bitly/go-simplejson v0.5.0 // indirect
	github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/emirpasic/gods v1.12.0 // indirect
	github.com/fatih/color v1.9.0 // indirect
	github.com/fsnotify/fsnotify v1.4.9 // indirect
	github.com/go-git/gcfg v1.5.0 // indirect
	github.com/go-git/go-billy/v5 v5.3.1 // indirect
	github.com/go-git/go-git/v5 v5.4.2 // indirect
	github.com/go-logr/logr v0.4.0 // indirect
	github.com/go-sql-driver/mysql v1.5.0 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/golang/protobuf v1.5.2 // indirect
	github.com/google/go-cmp v0.5.6 // indirect
	github.com/google/gofuzz v1.1.0 // indirect
	github.com/google/uuid v1.2.0 // indirect
	github.com/googleapis/gnostic v0.5.5 // indirect
	github.com/hashicorp/consul/api v1.9.0 // indirect
	github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
	github.com/hashicorp/go-hclog v0.12.0 // indirect
	github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
	github.com/hashicorp/go-rootcerts v1.0.2 // indirect
	github.com/hashicorp/golang-lru v0.5.1 // indirect
	github.com/hashicorp/serf v0.9.5 // indirect
	github.com/imdario/mergo v0.3.12 // indirect
	github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
	github.com/jinzhu/inflection v1.0.0 // indirect
	github.com/json-iterator/go v1.1.11 // indirect
	github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
	github.com/mattn/go-colorable v0.1.8 // indirect
	github.com/mattn/go-isatty v0.0.12 // indirect
	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
	github.com/miekg/dns v1.1.43 // indirect
	github.com/mitchellh/go-homedir v1.1.0 // indirect
	github.com/mitchellh/hashstructure v1.1.0 // indirect
	github.com/mitchellh/mapstructure v1.3.3 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.1 // indirect
	github.com/nxadm/tail v1.4.8 // indirect
	github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
	github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/prometheus/client_golang v1.1.0 // indirect
	github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
	github.com/prometheus/common v0.6.0 // indirect
	github.com/prometheus/procfs v0.0.3 // indirect
	github.com/russross/blackfriday/v2 v2.0.1 // indirect
	github.com/sergi/go-diff v1.1.0 // indirect
	github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
	github.com/sirupsen/logrus v1.7.0 // indirect
	github.com/spf13/pflag v1.0.5 // indirect
	github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
	github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
	github.com/urfave/cli/v2 v2.3.0 // indirect
	github.com/xanzy/ssh-agent v0.3.0 // indirect
	go.uber.org/atomic v1.7.0 // indirect
	go.uber.org/multierr v1.1.0 // indirect
	go.uber.org/ratelimit v0.2.0 // indirect
	go.uber.org/zap v1.10.0 // indirect
	golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
	golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
	golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
	golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
	golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
	golang.org/x/text v0.3.6 // indirect
	golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
	google.golang.org/appengine v1.6.5 // indirect
	gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
	gopkg.in/inf.v0 v0.9.1 // indirect
	gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
	gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
	gopkg.in/warnings.v0 v0.1.2 // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
	k8s.io/apimachinery v0.22.4 // indirect
	k8s.io/klog/v2 v2.9.0 // indirect
	k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
	sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
	sigs.k8s.io/yaml v1.2.0 // indirect
)

验证结果:

PS D:\go-projects\git.imooc.com\coding-535\user> go mod tidy
go: downloading git.imooc.com/coding-535/common v0.0.0-20220913123407-af94ee6eb5c3
PS D:\go-projects\git.imooc.com\coding-535\user>

goland的代码是绿色的,就表明成功了!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2158310.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

论文集搜索网站-dblp 详细使用方法

分享在dblp论文集中的两种论文搜索方式:关键字搜索,指定会议/期刊搜索。 关键字搜索 进入dblp官方网址dblp: computer science bibliography,直接在上方搜索栏,搜索关键字,底下会列出相关论文。 指定会议/期刊搜索 …

Java多线程(1)—线程基础

一、关于线程 1.1 简介 计算机线程(Thread)是操作系统能够进行运算调度的最小单位。线程的优势在于提高了程序的效率和响应能力,尤其在处理 I/O 操作或多任务时。多线程编程能够充分利用多核处理器的计算能力,达到更高的性能。 …

解决IDEA出现:java: 程序包javax.servlet不存在的问题

问题截图: 解决如下: 1. 点击文件——>项目结构 2. 点击库——>点击——>点击java 3. 找到Tomcat的文件夹,找到lib文件夹中的servlet-api.jar,点击确定 4. 选择要添加的模块 5. 点击应用——>确定

Deep Guided Learning for Fast Multi-ExposureImage Fusion

Abstract 我们提出了一种快速多重曝光图像融合(MEF)方法,即 MEF-Net,用于任意空间分辨率和曝光次数的静态图像序列。 我们首先将输入序列的低分辨率版本提供给全卷积网络以进行权重图预测。 然后,我们使用引导滤波器联…

NGO电工钢行业分析:未来几年年复合增长率CAGR为2.7%

NGO电工钢,顾名思义,其磁性具有各向同性性(也叫各向同性电工钢),广泛应用于制造各类电机、发电机铁心。 据QYResearch调研团队最新报告“全球NGO电工钢市场报告2024-2030”显示,预计2030年全球NGO电工钢市场…

镜舟科技面对亿级数据分析场景,如何做到金融级放心用?

引言 中国金融数据库行业研究报告(2023)指出,自 2020 年的⾦融信创元年, 中国数据库迎来了⾼速发展。 进入 2024 年,镜舟科技的商业拓展速度进一步加快。在过去半年里,镜舟科技与十余家头部股份制银行、…

【人工智能】Transformers之Pipeline(十九):文生文(text2text-generation)

目录 一、引言 二、文生文(text2text-generation) 2.1 概述 2.2 Flan-T5: One Model for ALL Tasks 2.3 pipeline参数 2.3.1 pipeline对象实例化参数 2.3.2 pipeline对象使用参数 ​​​​​​​ 2.3.3 pipeline返回参数 ​​​​​​​​​​​…

C语言 fwirte 函数 - C语言零基础入门教程

目录 一.fwirte 函数简介二.fwirte 函数使用三.猜你喜欢 零基础 C/C 学习路线推荐 : C/C 学习目录 >> C 语言基础入门 一.fwirte 函数简介 C 语言文件读写,fread 函数用于读取文件中的数据到指定缓冲区中,而 fwrite 函数用于把缓冲区数据写入到文件…

【Redis技能熟练掌握之十年内功】

Redis技能熟练掌握之十年内功 1.redis是什么?为什么要使用redis?2.redis一般应用于什么场景(四个场景)?3. Redis持久化机制是什么?各自的优缺点?一般咋么用?4. redis五个基础类型支持…

Microsoft Edge WebView2运行时安装包获取

目前越来越多的软件将WebView2当做运行时,发现一些精简版的系统精简掉了WebView2或者人为误删除,一些软件无法正常运行,我们可以重新安装即可 浏览器访问WebView2官方页面 https://developer.microsoft.com/zh-cn/microsoft-edge/webview2/ …

kafka负载均衡迁移(通过kafka eagle)

在grafana监控中发现kafka的各个节点磁盘不均匀 出现这样的情况是因为kafka默认是以文件数作为平衡的条件的。换句话说,kafka不会管一个副本有多大,只会看磁盘中有多少个副本文件。 解决方式: 1、修改策略,改为按照磁盘大小平衡…

计算机毕设设计推荐-基于python+Djanog大数据的电影数据可视化分析

精彩专栏推荐订阅:在下方主页👇🏻👇🏻👇🏻👇🏻 💖🔥作者主页:计算机毕设木哥🔥 💖 文章目录 一、电影数据可视…

数控机床中的滚柱导轨什么情况下需要重新更换?

滚柱导轨是数控机床中重要的传动零部件,主要用于支撑和引导运动部件的直线运动,它的故障通常会导致加工精度下降、噪音大、导轨摩擦不顺畅等问题。那么,我们应该如何确定滚柱导轨是否需要更换呢? 1、‌外观检查‌:首先…

第二证券:“产业+科技” 中国并购重组市场持续升温

A股商场正在进入新一轮并购重组周期。新“国九条”出台以来,多项关于并购重组商场的方针接连推出,方针环境不断优化,相关事例数量较去年同期显着增加。从具体事例来看,工业链整合成为本年并购商场的重要“主线”,以“硬…

QT菜单之快捷菜单设计

快捷菜单又称为上下文菜单,通常在用鼠标右击的时候弹出。创建快捷菜单的方法和创建菜单栏菜单类似。 效果图: 一、将MainWindow类对象的ContextMenuPolicy属性设置为customContextMenu。 打开mainWindow.ui,在属性视图上找到ContextMenuPoli…

ubuntu、linux安装redis(使用tar包的方式)

目录 1、准备redis的tar包 2、执行make 3、执行make install 4、运行redis 5、总结 1、准备redis的tar包 去官网或者github上下载对应的tar包,我下载的是 redis-6.2.14.tar.gz 上传到ubuntu后,使用指令进行解压: tar -xvf redis-6.2.14.t…

内卷时代企业数字化营销策略

当前,内循环经济为主的后疫情时代消费心理的变化表现如下: 1. 焦虑与压力感增加 内卷时代的竞争压力和不确定性给消费者带来了焦虑和压力感。他们在消费过程中,不仅关注产品的功能和价值,还希望通过消费来缓解压力、获得心理上的…

S2-057远程执⾏代码漏洞

启动环境 vulhub靶场 /struts2/s2-057 访问 http://172.16.1.45:8080/struts2-showcase http://172.16.1.45:8080/struts2-showcase/${(123123)}/register2.action http://172.16.1.137:8080/struts2-showcase/$%7B%0A%28%23dm%3Dognl.OgnlContextDEFAULT_MEMBER_ACCESS%29.%28…

地图(高德)判断某一点位是否位于某一城市/区域/地区/行政区划内

地图(高德)判断某一点位是否位于某一城市/地区/行政区划内 这里以高德地图示例,其他地图思路是类似的 调用API(可以申请api选择web服务获取key) https://restapi.amap.com/v3/config/district?keyyourAppKey&keywords330500&exte…