gpt4 book ai didi

golang 导入 github 私有(private)仓库

转载 作者:行者123 更新时间:2023-12-01 22:08:39 24 4
gpt4 key购买 nike

完全糊涂了。

使用模块去 1.13.5

我正在尝试从 github 导入私有(private)仓库。搜索增加了困惑,而不是减少了它。我尝试了多种方法,包括钥匙串(keychain)助手,但我无处可去。

SSH 已启用,并在测试时成功建立连接

我在 C:/Users/me 中的全局 gitconfig :

[user]
name = xxxxxxx
email = xxx.xxx@me.com
[core]
autocrlf = input
[alias]
st = status
[url "ssh://git@github.com/"]
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/repo@v0.0.0-20191211180807-ee1bcd94c84f:
github.com/user/repo@v0.0.0-20191211180807-ee1bcd94c84f: reading
https://sum.golang.org/lookup/github.com/!user/repo@v0.0.0-20191211180807-
ee1bcd94c84f:410 Gone

链接产生:
not found: github.com/user/repo@v0.0.0-20191211180807-ee1bcd94c84f: 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

这是怎么回事??

到目前为止,还没有感受到对模块的热爱让我的生活更轻松......

最佳答案

经过更多搜索和大量实验后,问题在于下载私有(private) repo 时校验和失败,因为根据定义,没有定义校验和。
这被隐藏在 Github 上的一系列回复中。有一个 Unresolved 问题可以改进文档。好主意。
这对我有用:

GONOSUMDB=github.com/username/* 
go get github.com/username/repo

关于golang 导入 github 私有(private)仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59344090/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com