简体   繁体   English

SSH已添加,但仍然很致命无法从远程存储库读取

[英]SSH Added, but still fatal Could not read from remote repository

When I do the following: 当我执行以下操作时:

$ git pull origin master

it returns: 它返回:

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

As directed by GitHub instructions I have verified the following: 按照GitHub的指示,我已经验证了以下内容:

1) Created a key using the following command: 1)使用以下命令创建密钥:

ssh-keygen -t rsa -b 4096 -C "myemail@gmail.com" and named it GitHub which returned: ssh-keygen -t rsa -b 4096 -C "myemail@gmail.com"并将其命名为GitHub,它返回:

Your identification has been saved in GitHub.
Your public key has been saved in GitHub.pub.

2) Added to my SSH Agent in both the .ssh directory and the local repo location: 2)在.ssh目录和本地存储库位置中都添加到了我的SSH代理中:

eval "$(ssh-agent -s)"

and

ssh-add -K ~/.ssh/GitHub

which returned: 返回:

Identity added: /Users/myUserName/.ssh/GitHub (/Users/myUserName/.ssh/GitHub)

3) Copied the key using pbcopy < ~/.ssh/GitHub.pub and pasted the key in the appropriate settings area in GitHub settings page. 3)使用pbcopy < ~/.ssh/GitHub.pub复制密钥,并将密钥粘贴到GitHub设置页面的相应设置区域中。

4) From my local repo location I do a ssh -T git@github.com and it returns: 4)从我的本地仓库位置,我执行ssh -T git@github.com并返回:

Hi ConfusedDeer! You've successfully authenticated, but GitHub does not provide shell access.

5) I also do a ssh-add -l to verify it has been added to my ssh agent and it returns: 4096 SHA256:PcgDpZHUEepM/cQvVn525I5fgwCgVj98wEloWiosQ4s /Users/myUserName/.ssh/GitHub (RSA) 5)我还执行ssh-add -l以验证它已添加到我的ssh代理中,并返回: 4096 SHA256:PcgDpZHUEepM/cQvVn525I5fgwCgVj98wEloWiosQ4s /Users/myUserName/.ssh/GitHub (RSA)

6) I did a git remote -v to verify the origin location is correct and it returns: 6)我做了一个git remote -v来验证原始位置是否正确,并返回:

origin  ssh://github.com/ConfusedDeer/myiOSapp.git (fetch)
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (push)

and I compare them to the my GitHub account and it seems fine: git@github.com:ConfusedDeer/myiOSapp.git 然后将它们与我的GitHub帐户进行比较,看起来不错: git@github.com:ConfusedDeer/myiOSapp.git

7) I noticed the newly added GitHub key on the settings interface was black, but after I did the ssh -T git@github.com it is now green and states: Added on Mar 19, 2017 Last used within the last day 7)我注意到设置界面上新添加的GitHub键为黑色,但是在执行ssh -T git@github.com它现在ssh -T git@github.com绿色,并指出: Added on Mar 19, 2017 Last used within the last day

Did I miss a step? 我错过了一步吗? Any other troubleshooting steps I could try? 我可以尝试其他任何疑难解答步骤吗? Suggestions? 建议?

The issue was that I needed to switch my remote urls from HTTPS to SSH: I found instructions on GitHub . 问题是我需要将远程URL从HTTPS切换到SSH:我在GitHub上找到了说明

I needed to change 我需要改变

FROM: 从:

origin  ssh://github.com/ConfusedDeer/myiOSapp.git (fetch)
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (push)

TO: 至:

origin  git@github.com:ConfusedDeer/myiOSapp.git (fetch)
origin  git@github.com:ConfusedDeer/myiOSapp.git (push)

by doing the following command: 通过执行以下命令:

git remote set-url origin git@github.com:ConfusedDeer/myiOSapp.git

Your github account does not show any repositories. 您的github帐户未显示任何存储库。

  1. Does the repository actually exist ? 该存储库实际存在吗? (Just open it in the browser. Eg for ssh://github.com/ConfusedDeer/myiOSapp.git open http://github.com/ConfusedDeer/myiOSapp ) (只需在浏览器中将其打开。例如ssh://github.com/ConfusedDeer/myiOSapp.git打开http://github.com/ConfusedDeer/myiOSapp
  2. Try a fresh clone: git clone ssh://github.com/ConfusedDeer/myiOSapp.git and see if that works 尝试一个新的克隆: git clone ssh://github.com/ConfusedDeer/myiOSapp.git ,看看是否git clone ssh://github.com/ConfusedDeer/myiOSapp.git

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM