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.xdnf.cn/news/149259.html

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

相关文章

基于WebServer的工业数据采集系统

一、项目框架及流程 二、http简介 HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于Web Browser(浏览器)到Web Server(服务器)进行数据交互的传输协议。 HTTP是应用层协…

C/C++语言基础--C++构造函数、析构函数、深拷贝与浅拷贝等等相关知识讲解

本专栏目的 更新C/C的基础语法,包括C的一些新特性 前言 周末休息了,没有更新,请大家见谅哈;构造函数、析构函数可以说便随着C每一个程序,故学构造函数、析构函数是必要的;C语言后面也会继续更新知识点&am…

计算机的错误计算(一百零二)

摘要 探讨 的计算精度问题。 从计算机的错误计算(九十九)可知, 在IEEE 754-2019的列表中。因此,有必要分析其计算准确度。 例1. 已知 计算 若利用 Python的SciPy库中函数计算,则有: 若用Java的pow函…

通过 LabVIEW 正则表达式读取数值(整数或小数)

在LabVIEW开发中,字符串处理是一个非常常见的需求,尤其是在处理包含复杂格式的数字时。本文通过一个具体的例子来说明如何利用 Match Regular Expression Function 和 Match Pattern Function 读取并解析字符串中的数字,并重点探讨这两个函数…

毕业设计选题:基于ssm+vue+uniapp的英语学习激励系统小程序

开发语言:Java框架:ssmuniappJDK版本:JDK1.8服务器:tomcat7数据库:mysql 5.7(一定要5.7版本)数据库工具:Navicat11开发软件:eclipse/myeclipse/ideaMaven包:M…

达梦-华为鲲鹏ARM架构下性能测试最佳实践

一、测试综述 1.1 测试目的 本次测试的目的是验证达梦数据库,在鲲鹏服务器下,不同服务器参数基于sysbench性能压力测试的表现。本次参数是根据为华为鲲鹏arm服务器调优十板斧内建议值调整 成长地图-鲲鹏开发套件开发文档-鲲鹏社区 1.2 通用指标 指标…

虚幻蓝图Ai随机点移动

主要函数: AI MoveTo 想要AI移动必须要有 导航网格体边界体积 (Nav Mesh Bounds Volume) , 放到地上放大 , 然后按P键 , 可以查看范围 然后创建一个character类 这样连上 AI就会随机运动了 为了AI移动更自然 , 取消使用控制器旋转Yaw 取消角色移动组件 的 使用控制器所需的…

关于Cursor使用的小白第一视角

最近看破局感觉洋哥总是提到cursor,感觉好火,所以打算学习一下怎么用Cursor,如果可以希望能做一个我自己的网站。 之前从来没用过Cursor。所以,这是一篇小白视角的Cursor使用教程。 如果你也是一个小白,并且对Cursor…

ArcGIS Desktop使用入门(三)图层右键工具——拓扑(上篇:地图拓扑)

系列文章目录 ArcGIS Desktop使用入门(一)软件初认识 ArcGIS Desktop使用入门(二)常用工具条——标准工具 ArcGIS Desktop使用入门(二)常用工具条——编辑器 ArcGIS Desktop使用入门(二&#x…

Maven配置及使用

1. Maven简介和安装 1.1. Maven是一个依赖管理工具 问题: jar包的规模 随着使用框架越来越多,或框架的封装程度越来越高,项目中使用的jar包也越来越多。项目中,一个模块里用到上百个jar包是非常正常的jar包的来源 jar包所属技术…

LeetCode 面试经典150题 201.数字范围按位与

题目&#xff1a;给你两个整数 left 和 right &#xff0c;表示区间 [left, right] &#xff0c;返回此区间内所有数字 按位与 的结果&#xff08;包含 left 、right 端点&#xff09;。 提示&#xff1a;0 < left < right < 2^31 - 1 思路&#xff1a; 位与的特性…

《一本书讲透Elasticsearch》读书笔记(二)

Elasticsearch集群部署 Elastic Stack集群部署基础知识 Elasticsearch、Logstash、Beats、Kibana全部都支持跨平台部署 集群部署平台及操作系统的选型 可供选择的部署平台包括实体服务器、虚拟机&#xff08;VMWare、OpenStack等&#xff09;​、容器化平台&#xff08;Doc…

链式队列操作

文章目录 &#x1f34a;自我介绍&#x1f34a;概述&#x1f34a;链式队列代码linkstack.clinkstack.hmain.c 你的点赞评论就是对博主最大的鼓励 当然喜欢的小伙伴可以&#xff1a;点赞关注评论收藏&#xff08;一键四连&#xff09;哦~ &#x1f34a;自我介绍 Hello,大家好&…

课程表-LeetCode100

现在你总共有 numCourses 门课需要选&#xff0c;记为 0 到 numCourses - 1。给你一个数组 prerequisites &#xff0c;其中 prerequisites[i] [ai, bi] &#xff0c;表示在选修课程 ai 前 必须 先选修 bi 。 例如&#xff0c;想要学习课程 0 &#xff0c;你需要先完成课程 1…

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

计算机前沿技术-人工智能算法-大语言模型-最新论文阅读-2024-09-23 本期&#xff0c;我们对大语言模型在表情推荐, 软件安全和 自动化软件漏洞检测等方面如何应用&#xff0c;提供几篇最新的参考文章。 1 Semantics Preserving Emoji Recommendation with Large Language Mod…

机器学习中分类问题的各类评估指标总结

机器学习中分类问题的各类评估指标总结 在机器学习的世界里&#xff0c;分类问题占据了半壁江山。从垃圾邮件检测到疾病诊断&#xff0c;从用户行为分析到市场趋势预测&#xff0c;分类算法的应用无处不在。然而&#xff0c;如何评价一个分类模型的性能&#xff0c;却是一门大…

MovieLife 电影生活

MovieLife 电影生活 今天看到一个很有意思的项目&#xff1a;https://www.lampysecurity.com/post/the-infinite-audio-book “我有一个看似愚蠢的想法。通常&#xff0c;这类想法只是一闪而过&#xff0c;很少会付诸实践。但这次有所不同。假如你的生活是一部电影&#xff0c…

Stable Diffusion 使用详解(13)--- 3D纹理增强

目录 背景 Normal Map 描述 原理 使用心得 例子 描述 原图 参数设置 底模 ​编辑 正负相关性提示词 其他参数 controlnet 效果 还能做点啥 调整 效果 背景 实际上&#xff0c;在stable diffusion 中&#xff0c;你获取发现很多controlnet 其实功能有点类似&…

webview2加载本地页面

加载方式 通过导航到文件 URL 加载本地内容 使用方式&#xff1a; webView->Navigate( L"file:///C:/Users/username/Documents/GitHub/Demos/demo-to-do/index.html"); 但是这种方式存在一些问题&#xff0c;比如&#xff1a; 存在跨域问题&#xff08;我加载…

Java语言程序设计基础篇_编程练习题***18.33 (游戏:骑士旅途的动画)

目录 ***18.33 (游戏:骑士旅途的动画) 习题思路 代码示例 动画演示 ***18.33 (游戏:骑士旅途的动画) 为骑士旅途的问题编写一个程序&#xff0c;该程序应该允许用户将骑士放到任何一个起始正方形&#xff0c;并单击Solve按钮&#xff0c;用动画展示骑士沿着路径的移动&…