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

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

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

相关文章

江协科技STM32学习- P14 示例程序(定时器定时中断和定时器外部时钟)

🚀write in front🚀 🔎大家好,我是黄桃罐头,希望你看完之后,能对你有所帮助,不足请指正!共同学习交流 🎁欢迎各位→点赞👍 收藏⭐️ 留言📝​…

传输层协议 —— TCP协议(上篇)

目录 1.认识TCP 2.TCP协议段格式 3.可靠性保证的机制 确认应答机制 超时重传机制 连接管理机制 三次握手 四次挥手 1.认识TCP 在网络通信模型中,传输层有两个经典的协议,分别是UDP协议和TCP协议。其中TCP协议全称为传输控制协议(Tra…

后台数据管理系统 - 项目架构设计-Vue3+axios+Element-plus(0920)

十三、文章分类页面 - [element-plus 表格] Git仓库:https://gitee.com/msyycn/vue3-hei-ma.git 基本架子 - PageContainer 功能需求说明: 基本架子-PageContainer封装文章分类渲染 & loading处理文章分类添加编辑[element-plus弹层]文章分类删除…

pg入门3—详解tablespaces—下

pg默认的tablespace的location为空,那么如果表设置了默认的tablespace,数据实际上是存哪个目录的呢? 在 PostgreSQL 中,如果你创建了一个表并且没有显式指定表空间(tablespace),或者表空间的 location 为…

OpenCV运动分析和目标跟踪(4)创建汉宁窗函数createHanningWindow()的使用

操作系统:ubuntu22.04 OpenCV版本:OpenCV4.9 IDE:Visual Studio Code 编程语言:C11 算法描述 此函数计算二维的汉宁窗系数。 createHanningWindow是OpenCV中的一个函数,用于创建汉宁窗(Hann window)。汉宁…

肾癌的多模态预测模型-临床-组织学-基因组

目录 摘要 技术路线 ① lncRNA的预测模型 ②病理 WSI 的分类器 ③临床病理分类器 模型结果 与别的模型比较 同行评审学习 1)使用lncRNA的原因 2)模型临床使用意义 3)关于截止值的使用 摘要 A multi-classifier system integrated…

STC89C52定时器与中断 详细介绍 0基础入门

STC89C52定时器与中断 前言定时器/计数器定时器/计数器 功能选择定时器/计数器 模式选择使用寄存器进行功能选择与模式选择 中断使用寄存器进行中断配置中断执行操作 总结完整程序 前言 对于定时器与中断,这是两个完全不同的概念,在单片机中它们也对应着…

【HTTP】认识 URL 和 URL encode

文章目录 认识 URLURL 基本格式**带层次的文件路径****查询字符串****片段标识符** URL encode 认识 URL 计算机中非常重要的概念,并不仅仅是在 HTTP 中使用。用来描述一个网络资源所处的位置,全称“唯一资源定位符” URI 是“唯一资源标识符“严格的说…

mac命令行分卷压缩与合并

对当前目录内的文件压缩的同时分卷 //语法:zip -r -s 1m 压缩文件名.zip 当前路径 zip -r -s 1m split.zip . //解压 zip -s 0 split.zip --out unsplit.zip unzip unsplit.zip 将一个zip文件进行分卷 一个900k的压缩包名为hello.zip,将其分割为每500K一个zip zip - hello.…

Microsoft Edge 五个好用的插件

🐣个人主页 可惜已不在 🐤这篇在这个专栏 插件_可惜已不在的博客-CSDN博客 🐥有用的话就留下一个三连吧😼 目录 Microsoft Edge 一.安装游览器 ​编辑 二.找到插件商店 1.打开游览器后,点击右上角的设置&#…

第十四章:html和css做一个心在跳动,为你而动的表白动画

💖 让心跳加速,传递爱意 💖 在这个特别的时刻,让爱在跳动中绽放!🌟 无论是初次相遇的心动,还是陪伴多年的默契,我们的心总在为彼此跳动。就像这颗炙热的爱心,随着每一次的跳动,传递着满满的温暖与期待。 在这个浪漫的季节,让我们一同感受爱的律动!无论你是在…

计算机前沿技术-人工智能算法-大语言模型-最新论文阅读-2024-09-19

计算机前沿技术-人工智能算法-大语言模型-最新论文阅读-2024-09-19 1. SAM4MLLM: Enhance Multi-Modal Large Language Model for Referring Expression Segmentation Authors: Yi-Chia Chen, Wei-Hua Li, Cheng Sun, Yu-Chiang Frank Wang, Chu-Song Chen SAM4MLLM: 增强多模…

防火墙详解(三)华为防火墙基础安全策略配置(命令行配置)

实验要求 根据实验要求配置防火墙: 合理部署防火墙安全策略以及安全区域实现内网用户可以访问外网用户,反之不能访问内网用户和外网用户均可以访问公司服务器 实验配置 步骤一:配置各个终端、防火墙端口IP地址 终端以服务器为例&#xff…

离散制造 vs 流程制造:锚定精准制造未来,从装配线到化学反应,实时数据集成在制造业案例中的多维应用

使用 TapData,化繁为简,摆脱手动搭建、维护数据管道的诸多烦扰,轻量替代 OGG, Kettle 等同步工具,以及基于 Kafka 的 ETL 解决方案,「CDC 流处理 数据集成」组合拳,加速仓内数据流转,帮助企业…

Android IME输入法启动显示隐藏流程梳理

阅读Android AOSP 12版本代码,对输入法IME整体框架模块进行学习梳理,内容包含输入法框架三部分IMM、IMMS、IMS的启动流程、点击弹出流程、显示/隐藏流程,以及常见问题和调试技巧。 1. IME整体框架​​​​​​​ IME整体分为三个部分&#xf…

股指期货的持仓量指标如何分析?有哪些作用?

股指期货市的持仓量是一个极其重要的指标,它就像市场的“晴雨表”,能反映出投资者的信心、市场的热度以及潜在的趋势。下面,我们就用大白话的方式来详细解读一下股指期货持仓量指标的分析方法及其作用。 一、什么是股指期货持仓量&#xff1…

用CPU训练机器学习模型

人工智能最近的成功通常归功于 GPU 的出现和发展。GPU 的架构通常包括数千个多处理器、高速内存、专用张量核心等,特别适合满足人工智能/机器学习工作负载的密集需求。 不幸的是,人工智能开发的快速增长导致对 GPU 的需求激增,使得 GPU 难以…

ESP32/ESP8266开发板单向一对多ESP-NOW无线通信

目录 简介读取ESP32/ESP8266接收方Receiver的MAC地址ESP32发送方Sender程序ESP32/ESP8266接收方Receiver程序ESP-NOW通信验证总结 简介 本实验通过ESP-NOW无线通信协议实现ESP32开发板向多个ESP32/ESP 8266开发板发送数据。 读取ESP32/ESP8266接收方Receiver的MAC地址 读取…

Nginx反向代理出现502 Bad Gateway问题的解决方案

🎉 前言 前一阵子写了一篇“关于解决调用百度翻译API问题”的博客,近日在调用其他API时又遇到一些棘手的问题,于是写下这篇博客作为记录。 🎉 问题描述 在代理的遇到过很多错误码,其中出现频率最高的就是502&#x…

LabVIEW提高开发效率技巧----代码规范与文档记录

良好的代码规范与文档记录在LabVIEW开发中至关重要。它不仅能够大幅提升开发效率,还为后续的维护和项目交接提供便利。下面将从命名规则、注释标准、功能说明等多个角度,介绍如何通过规范化开发提高项目的可维护性与协作性。 1. 保持一致的命名规则 在L…