当 git clone 工作时,Go mod tidy 在私有存储库上失败

Predrag3141

我将我的 ssh 密钥放在 github 中,因此git clone适用于某个私有存储库;go mod tidy尝试访问同一存储库时失败,错误消息如下所示我可以使用帮助解决此问题。go mod tidy来自(编辑私有存储库的名称,但逐字逐句)的错误消息是:

    github.com/[private repository path]: cannot find module providing package github.com/[private repository path]: module github.com/[private repository path]: git ls-remote -q origin in /mnt/dependencies/gopath/pkg/mod/cache/vcs/a1f499df6a9855aecdc77bda31504008583a3268fdd403799aade71bb47df7d2: exit status 128:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository

Please make sure you have the correct access rights
and the repository exists.

成功的 git clone 命令(再次编辑私有存储库)是:

git clone [email protected]:[private repository path].git

我的.gitconfig文件是(我的姓名和电子邮件已编辑):

[user]
    name = [my name]
    email = [my email]
[url "github.com:"]
    insteadOf = https://github.com/
[core]
    excludesfile = /workdir/.gitignore

其他可能会产生影响的事情:

  • 我在 Docker 容器中以 root 身份运行命令。
  • 我尝试使用与 Docker 容器上go mod tidy相同的密钥在我的主机上运行~/.ssh,​​我得到了登录提示,github 不再支持(他们需要 SSH 密钥或个人访问令牌)。
  • 我的 gitconfig 中的电子邮件与我放在 github.com 上的公钥中给出的电子邮件相匹配。

第二个相关问题:我可以运行的事实是否git clone排除了将密钥错误地上传到 github,而忘记为 github 上的密钥启用 SSO?

这是一个类似的问题,但它涉及个人访问令牌而不是 ssh 密钥:`go mod tidy` 无法下载私有 GitHub 存储库

VonC

我在 Docker 容器中以 root 身份运行命令。

确保它确实访问了/root/.ssh与您在常规帐户中使用的相同的密钥(in )。

并检查 Git 全局配置设置是否真的包含您的insteadOf指令。

~/.ssh尝试使用与 Docker 容器上相同的密钥在我的主机上运行 go mod tidy,但我得到了登录提示。

这意味着公钥没有正确注册到 GitHub 用户配置文件,或者说用户无权访问存储库。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

私有存储库的git clone错误

在AWS EC2实例上的dockerfile中将git clone作为主机和私有git存储库运行时,主机验证失败错误

使用私有git存储库时go工作区的结构

HTTP上的`git clone`失败,显示“未找到存储库”

运行`ansible-galaxy install -r requirements.yml`时`git clone`在私有git repo中的角色失败

如何从 kubernetes init 容器中的私有 github 存储库 git clone

腻子的git clone失败

git clone 的存储效率

go mod tidy 错误消息:“但是 go 1.16 会选择”

go mod tidy "all" 不匹配任何包

go mod tidy 給出操作不允許的消息

致命的:安装mod_python时不是git存储库

无法在Ubuntu机器上git clone openshift存储库

如何安全地git clone / pip将私有存储库安装到我的Docker映像中?

无法 git push 但 git clone 工作

git clone-递归失败

使用终端的私有存储库的Git克隆失败

DNS查找有时无法进行git clone

Go Mod私有存储库在CloudBuild中读取错误的路径

使用git clone命令从azure devops中检出多个存储库时出错

尝试克隆TensorFlow存储库时git clone不起作用

尝试从私有 Codecommit 存储库中提取时,CodeBuild 上的 NPM 安装失败

Docker 映像 git clone 错误“致命:不是 git 存储库”

为什么使用 HTTPS 时 git clone 失败但使用 git 协议成功

在git中的远程存储库上创建私有分支

从dockerfile进行git clone时我怎么知道我在哪个git分支上

没有工作树的存储库上的 Git 操作?

go get和git clone之间的区别?

在python脚本中运行“ git clone https://remote.git”时,如何提供密码(带有@)?