GIT无法从远程存储库读取 [英] GIT Could not read from remote repository

查看:77
本文介绍了GIT无法从远程存储库读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经克隆了一个私人仓库,将其分叉,并将som更改更改为功能分支.当我尝试将这些更改推送到仓库中时,我收到以下消息:

I've cloned a private repo, forked it and made som changes into a feature branch. When I try to push these changes into the repo i get the following message:

Permission denied (publickey).
fatal: Could not read from remote repository.

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

我试图从Windows计算机controlpanel>凭据中删除git凭据,但它仍向我显示相同的错误.

I've tried to delete the git credentials from my windows computer controlpanel>credentials but it's still showing me the same error.

我是否有必要从终端登录和退出git?如果是这样,我该怎么办?

Is there any chance that I have to log in and out from my terminal to git? If that would be the case, how do I do that?

我也尝试过使用git push --set-upstream origin进行推送,但这只是向我显示了相同的错误.

I've also tried to push with git push --set-upstream origin but it's just showing me the same error.

你们中有人曾见过吗?

预先感谢,埃里克

推荐答案

帮助,按下时,我一直收到'Permission Denied(publickey)'错误!"

这意味着,在本地计算机上,您尚未创建任何SSH密钥.不用担心.解决方法如下:

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. 打开git bash(使用Windows搜索.要找到它,请键入"git bash")或Mac Terminal.专家提示:您可以使用任何基于* nix的命令提示(但不是默认的Windows命令提示符!)
  2. 键入cd〜/.ssh.这将带您到Git的根目录(就像Windows上的C:\ Users [YOUR-USER-NAME] .ssh \)
  3. 在.ssh文件夹中,应该有以下两个文件:id_rsa和id_rsa.pub.这些是告诉您计算机如何操作的文件与GitHub,BitBucket或任何其他基于Git的服务进行通信.键入ls以查看目录列表.如果这两个文件不显示向上,继续下一步.注意:您的SSH密钥必须命名id_rsa和id_rsa.pub,以便将Git,GitHub和BitBucket添加到默认情况下会识别它们.
  4. 要创建SSH密钥,请键入ssh-keygen -t rsa -C"your_email@example.com".这将同时创建id_rsa和id_rsa.pub文件.
  5. 现在,在您喜欢的文本编辑器中打开id_rsa.pub(您可以如果需要,可以通过Windows资源管理器或OSX Finder键入打开".将打开该文件夹).
  6. 复制内容-完全与显示的一样,没有多余的空格或线条-id_rsa.pub并将其粘贴到帐户设置> SSH密钥下的GitHub和/或BitBucket.笔记:我喜欢给SSH密钥一个描述性名称,通常使用该名称我所在的工作站的日期以及日期.
  7. 现在您已将公共密钥添加到Github和/或BitBucket,尝试再次git push,看看是否有效.应该的!

GitHub上提供了有关创建SSH密钥的更多帮助.

这篇关于GIT无法从远程存储库读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆