git pull 请确保您具有正确的访问权限并且存储库存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48980599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:04:12  来源:igfitidea点击:

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

git

提问by i.yuanx

I use the git pullcommand to update the code git cloneby my colleagues, encountered the following problems:

我用git pull命令来更新代码git clone通过my colleagues,遇到以下问题:

Permission denied (publickey).

fatal: Could not read from remote repository.

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

权限被拒绝(公钥)。

致命:无法从远程存储库读取。

请确保您拥有正确的访问权限并且存储库存在。

回答by Nithin Prasad

If your repository is cloned over HTTPS, then you probably might have to switch your remote GitHub URL. This can be achieved by using the below commands:

如果您的存储库是通过 HTTPS 克隆的,那么您可能需要切换远程 GitHub URL。这可以通过使用以下命令来实现:

  • git remote -v- This will list your existing remote command using the -vverbose option. This will show you whether you are using an HTTPS protocol or an SSH protocol.
  • git remote -v- 这将使用-v详细选项列出您现有的远程命令。这将显示您使用的是 HTTPS 协议还是 SSH 协议。

If my guess is correct and you are using SSH protocol then you have to switch from HTTPS to SSH using the below command:

如果我的猜测是正确的并且您使用的是 SSH 协议,那么您必须使用以下命令从 HTTPS 切换到 SSH:

  • git remote set-url origin <GitHub_HTTPS_URL>
  • git remote set-url origin <GitHub_HTTPS_URL>

Now, you can try again to issue your git pullcommand. You can use the set-urloption to switch back and forth from HTTPS protocol to SSH protocol and vice versa any number of times. Hope this helps!

现在,您可以再次尝试发出您的git pull命令。您可以使用该set-url选项在 HTTPS 协议和 SSH 协议之间来回切换任意次数,反之亦然。希望这可以帮助!

回答by Gel

I encountered this several times. Things that we could look at:

我多次遇到这种情况。我们可以看的东西:

  1. Make sure that the existing repository exists by typing git remote -v
    • if you get the an error - Most likely this occurred because the folder that contains the gitgot deleted, or renamed.
    • you may want to find the existing file or just clone the repo again (which may take some time, and you may have to start coding the part you had in the lost file).
  2. If this is not the case, probably something to do with your ssh-key. You must either set it up first - or you have not been given access. Try this link for a complete step for ssh-key configuration. This link here
  1. 通过键入确保现有存储库存在 git remote -v
    • 如果您收到错误消息 - 这很可能是因为包含该文件夹的文件夹git被删除或重命名。
    • 您可能想要找到现有文件或只是再次克隆存储库(这可能需要一些时间,您可能必须开始对丢失文件中的部分进行编码)。
  2. 如果不是这种情况,可能与您的 ssh 密钥有关。您必须先进行设置 - 否则您没有获得访问权限。尝试此链接以获取 ssh-key 配置的完整步骤。 这个链接在这里

Good luck.

祝你好运。

回答by Rudi

Permission denied (publickey).

权限被拒绝(公钥)。

This indicates that you are using ssh to access the remote repository, and that your ssh key is not accepted by the server. This can be because

这表明您正在使用 ssh 访问远程存储库,并且服务器不接受您的 ssh 密钥。这可能是因为

  • you don't have the key on your local machine
  • your key was not found by your local ssh client
  • the key was revoked on the server
  • 你的本地机器上没有密钥
  • 您的本地 ssh 客户端未找到您的密钥
  • 密钥在服务器上被撤销

You can check this by running git remote -vand run ssh -vvvwith the server account.

您可以通过使用服务器帐户运行git remote -v和运行来检查这一点ssh -vvv

For example, if your remote is [email protected]:git/git-scm.com.git, you run ssh -vvv [email protected]to examine your problem.

例如,如果您的遥控器是[email protected]:git/git-scm.com.git,则运行ssh -vvv [email protected]以检查您的问题。