Git:致命:无法从远程存储库读取。请确保您拥有正确的访问权限并且存储库存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30068298/
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
Git : fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists
提问by Napster
I am getting this error -
我收到此错误 -
D:\Projects\wamp\www\REPO [master]> git pull origin master
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The output of git remote -v
git remote -v的输出
D:\Projects\wamp\www\REPO [master]> git remote -v
origin [email protected]:username/repo.git (fetch)
origin [email protected]:username/repo.git (push)
Final message of ssh -Tv [email protected]command -
ssh -Tv [email protected]命令的最终信息-
Hi [My Username]! You've successfully authenticated, but GitHub does not provide shell access.
How can I solve it?
我该如何解决?
采纳答案by VonC
I asked in the discussion:
我在讨论中问:
does
ssh -T [email protected]
ouput the same username (in Hi [My Username]!
) as in the one used for the ssh url of your repo ([email protected]:username/repo.git
)?Sorry It not showing same name
确实
ssh -T [email protected]
输出中相同的用户名(in Hi [My Username]!
),如用于您的回购协议的SSH URL的一个([email protected]:username/repo.git
)?抱歉它没有显示相同的名称
That means somehow the credentials have changed.
这意味着凭据以某种方式发生了变化。
One solution would be to at least copy %HOME%\.ssh\id_rsa.pub
in the SSH keys section of the right GitHub account
一个解决办法是至少复制%HOME%\.ssh\id_rsa.pub
在右GitHub的帐户的SSH密钥部分
The OP adds:
OP补充说:
I am working on private repo. So In [email protected]:username/repo.git,
我正在研究私人回购。所以在 [email protected]:username/repo.git 中,
I replied:
我回答:
If you were able to clone/push to that repo whose username is not your own GitHub account, that must be because you had your previous public ssh key added as a contributor to that repo by the repo's owner.
What next is to ask that same repo owner to add your current public ssh key
%HOME%\.ssh\id_rsa.pub
to the repo contributor list.
So check with the owner that you (meaning your public ssh key) are declared as a contributor.
如果您能够克隆/推送到用户名不是您自己的 GitHub 帐户的存储库,那一定是因为您已将之前的公共 ssh 密钥添加为存储库所有者对该存储库的贡献者。
接下来是要求同一个 repo 所有者将您当前的公共 ssh 密钥添加
%HOME%\.ssh\id_rsa.pub
到 repo 贡献者列表中。
因此,请与所有者确认您(即您的公共 ssh 密钥)是否被声明为贡献者。
回答by Siyaram Malav
change your ssh url by an http url for your remote 'origin', use:
通过远程“来源”的 http url 更改 ssh url,使用:
> git remote set-url origin https://github.com/<user_name>/<repo_name>.git
It will ask for your GitHub password on the git push.
它会在 git push 上询问你的 GitHub 密码。
回答by Jaime Agudo
Sometimes that (copying the pub ssh key to github/bitbucket) is not enough, particularly with Bitbucket. You also may need to check if your ssh is using the identity you expect rather than messing up with git remote
有时(将 pub ssh 密钥复制到 github/bitbucket)是不够的,尤其是对于 Bitbucket。您可能还需要检查您的 ssh 是否正在使用您期望的身份而不是搞乱git remote
Check if the agent is using the same identity you pasted on github/bitbucket with ssh-add -l
. If missing add it with
检查代理是否使用与您在 github/bitbucket 上粘贴的相同身份ssh-add -l
。如果缺少添加它
ssh-add ~/.ssh/id_rsa_my_git_identity
ssh-add ~/.ssh/id_rsa_my_git_identity
Further details: https://confluence.atlassian.com/bitbucket/configure-multiple-ssh-identities-for-gitbash-mac-osx-linux-271943168.html
更多详情:https: //confluence.atlassian.com/bitbucket/configure-multiple-ssh-identities-for-gitbash-mac-osx-linux-271943168.html
回答by Muhan Alim
This error happened to me too as the original repository creator had left the company, which meant their account was deleted from the github team.
这个错误也发生在我身上,因为原始存储库创建者离开了公司,这意味着他们的帐户从 github 团队中删除。
git remote set-url origin https://github.com/<user_name>/<repo_name>.git
git remote set-url origin https://github.com/<user_name>/<repo_name>.git
And then
git pull origin develop
or whatever git command you wanted to execute should prompt you for a login and continue as normal.
然后
git pull origin develop
或者你想执行的任何 git 命令都应该提示你登录并继续正常操作。
回答by kip2
Sometimes this happens to me because of network problems. I don't understand the problem fully, but switching to a different sub-network or using VPN solves it
有时这会发生在我身上,因为网络问题。我不完全理解问题,但切换到不同的子网或使用 VPN 解决了它
回答by Saurabh Kumar
I got the very same errors too. In My case upgrading from Windows 7 to 8 messed up my settings. What helped was to regenerate the private and public SSH keys using PuTTYGen, and change the SSH tool in tortoisegit from SSH to Plink.
我也遇到了同样的错误。在我的情况下,从 Windows 7 升级到 8 搞砸了我的设置。有用的是使用 PuTTYGen 重新生成私有和公共 SSH 密钥,并将 tortoisegit 中的 SSH 工具从 SSH 更改为 Plink。
I have shared the step by step steps also at http://techblog.saurabhkumar.com/2015/09/using-tortoisegit-on-windows-with.html
我也在http://techblog.saurabhkumar.com/2015/09/using-tortoisegit-on-windows-with.html 上分享了一步一步的步骤
回答by BSB
This error can be because of no SSH key on the your local machine. Check the SSH key locally:
此错误可能是因为本地计算机上没有 SSH 密钥。在本地检查 SSH 密钥:
$ cat ~/.ssh/id_rsa.pub
If above command do not give any output use below command to create ssh key(Linux/Mac):
如果上面的命令没有给出任何输出,请使用下面的命令来创建 ssh 密钥(Linux/Mac):
$ ssh-keygen
Now again run cat ~/.ssh/id_rsa.pubThis is your SSH key. Copy and add this key to your SSH keys in on git. In gitlab/bitbucket go to
现在再次运行cat ~/.ssh/id_rsa.pub这是您的 SSH 密钥。将此密钥复制并添加到 git 中的 SSH 密钥中。在 gitlab/bitbucket 中转到
profile settings -> SSH Keys -> add Key
and add the key
并添加密钥
回答by otoloye
I had this issue and tried many things but still din't work. Eventually I decided to generate another SSH KEY
and boom - it worked. Follow this article by githubto guide you on how to generate your SSH KEY.
我遇到了这个问题并尝试了很多东西,但仍然无法正常工作。最终我决定产生另一个SSH KEY
繁荣 - 它奏效了。按照github 的这篇文章指导你如何生成你的SSH KEY.
Lastly don't forget to add it to your github settings. Click herefor a guide on how to add your SSH KEY
to your github account.
最后不要忘记将它添加到您的 github 设置中。单击此处获取有关如何将您添加SSH KEY
到 github 帐户的指南。
回答by Erdin? ?orbac?
Maybe, as in my silly situation, you may somehow created the ssh key by directly typing
也许,就像在我愚蠢的情况下一样,您可以通过直接键入以某种方式创建 ssh 密钥
ssh-keygen
And so it is created with the local system user credentials so they don't match, use full command like this and recreate
因此它是使用本地系统用户凭据创建的,因此它们不匹配,请使用像这样的完整命令并重新创建
ssh-keygen -t rsa -b 4096 -C "[email protected]"
回答by Krishna Bagale
Try:
尝试:
git config --global credential.helper cache
This command prevents git to ask username and password, not forever but with a default limit to 15 minutes.
此命令可防止 git 询问用户名和密码,但不是永远,但默认限制为 15 分钟。
git config --global credential.helper 'cache --timeout=3600'
This moves the default limit to 1 hour.
这会将默认限制移至 1 小时。