对于一个Golang开发者来说,牢固扎实的基础是十分重要的,golang学习网就来带大家一点点的掌握基础知识点。今天本篇文章带大家了解《golang导入github私人仓库》,主要介绍了,希望对大家的知识积累有所帮助,快点收藏起来吧,否则需要时就找不到了!
完全困惑。
使用模块转到 1.13.5
我正在尝试从 github 导入私人存储库。搜索只会增加混乱,而不是减少混乱。我尝试了多种方法,包括钥匙串助手,但我进展缓慢。
ssh 已启用并且测试时成功建立连接
我的全局 gitconfig 在 c:/users/me 中:
[user]
name = xxxxxxx
email = [email protected]
[core]
autocrlf = input
[alias]
st = status
[url "ssh://[email protected]/"]
insteadof = https://github.com/
去 github.com/user/repo@master 生成
go: finding github.com master go: finding github.com/user master go: finding github.com/user/repo master go: finding github.com/user/repo master go: downloading github.com/user/repo v0.0.0-20191211180807-ee1bcd94c84f verifying github.com/user/[email protected]: github.com/user/[email protected]: reading https://sum.golang.org/lookup/github.com/!user/[email protected] ee1bcd94c84f:410 gone
链接产生:
not found: github.com/user/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in/tmp/gopath/pkg/mod/cache/vcs/9524fc42cfd4910346f55f112665f9a51df7c4b31085d50baa5e01453e55ca58: exit status 128: fatal: could not read Username for 'https://github.com': terminal prompts disabled
无论我做什么,我都会收到“无法读取用户名”的消息,但我认为应该使用 ssh 而不是 https
这是怎么回事?
到目前为止,我还没有感受到对模块的热爱,让我的生活变得更轻松......
解决方案
经过更多搜索和大量实验,问题在于下载私人存储库时校验和失败,因为根据定义,没有定义校验和。
这被隐藏在 github 上的一系列响应中。有一个待解决的问题需要改进文档。好主意。
这对我有用:
GONOSUMDB=github.com/username/* go get github.com/username/repo
本篇关于《golang导入github私人仓库》的介绍就到此结束啦,但是学无止境,想要了解学习更多关于Golang的相关知识,请关注golang学习网公众号!
本文内容来源于互联网,如有侵权请联系删除。
