Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 已添加SSH,但仍然无法从远程存储库读取_Linux_Git_Github_Ssh - Fatal编程技术网

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

Linux 已添加SSH,但仍然无法从远程存储库读取,linux,git,github,ssh,Linux,Git,Github,Ssh,当我执行以下操作时: $ git pull origin master 它返回: Permission denied (publickey). fatal: Could not read from remote repository. Hi ConfusedDeer! You've successfully authenticated, but GitHub does not provide shell access. origin ssh://github.com/ConfusedDe

当我执行以下操作时:

$ git pull origin master
它返回:

Permission denied (publickey).
fatal: Could not read from remote repository.
Hi ConfusedDeer! You've successfully authenticated, but GitHub does not provide shell access.
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (fetch)
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (push)
根据GitHub的指示,我已验证了以下内容:

$ git pull origin master
1) 使用以下命令创建密钥:

ssh-keygen-t rsa-b4096-C”myemail@gmail.com“
并将其命名为GitHub 它返回:

Your identification has been saved in GitHub.
Your public key has been saved in GitHub.pub.
Identity added: /Users/myUserName/.ssh/GitHub (/Users/myUserName/.ssh/GitHub)
2) 在.SSH目录和本地repo位置中添加到我的SSH代理:

eval "$(ssh-agent -s)"

它返回:

Your identification has been saved in GitHub.
Your public key has been saved in GitHub.pub.
Identity added: /Users/myUserName/.ssh/GitHub (/Users/myUserName/.ssh/GitHub)
3) 使用
pbcopy<~/.ssh/GitHub.pub
并将密钥粘贴到GitHub设置页面的相应设置区域

4) 从我的本地回购位置,我做了一个
ssh-Tgit@github.com
并返回:

Permission denied (publickey).
fatal: Could not read from remote repository.
Hi ConfusedDeer! You've successfully authenticated, but GitHub does not provide shell access.
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (fetch)
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (push)
5) 我还执行了一个
ssh add-l
来验证它是否已添加到我的ssh代理中,并返回:
4096 SHA256:pcgdpzhuepm/cqvvn525i5fgwcgvj98wellowiosq4s/Users/myUserName/.ssh/GitHub(RSA)

6) 我执行了一个
git remote-v
来验证原始位置是否正确,它是否返回:

Permission denied (publickey).
fatal: Could not read from remote repository.
Hi ConfusedDeer! You've successfully authenticated, but GitHub does not provide shell access.
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (fetch)
origin  ssh://github.com/ConfusedDeer/myiOSapp.git (push)
我将它们与我的GitHub帐户进行比较,结果似乎不错:
git@github.com:confusedder/myiOSapp.git

7) 我注意到设置界面上新添加的GitHub键是黑色的,但是在我执行
ssh-T之后git@github.com
现在为绿色,并注明:
于2017年3月19日添加,最后一天内最后一次使用


我漏了一步吗?我还可以尝试其他故障排除步骤吗?建议

您的github帐户不显示任何存储库

  • 存储库是否确实存在?(只需在浏览器中打开它。例如,
    ssh://github.com/ConfusedDeer/myiOSapp.git
    open
    http://github.com/ConfusedDeer/myiOSapp
  • 尝试新克隆:
    git克隆ssh://github.com/ConfusedDeer/myiOSapp.git
    然后看看这是否有效

  • 问题是我需要将我的远程URL从HTTPS切换到SSH:我发现

    我需要改变

    发件人:

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

    origin  ssh://github.com/ConfusedDeer/myiOSapp.git (fetch)
    origin  ssh://github.com/ConfusedDeer/myiOSapp.git (push)
    
    origin  git@github.com:ConfusedDeer/myiOSapp.git (fetch)
    origin  git@github.com:ConfusedDeer/myiOSapp.git (push)
    
    通过执行以下命令:


    git远程设置url源git@github.com:confusedder/myiOSapp.git

    用户是否已添加到github的项目中?简单但值得检查。@zatta你能更具体一点吗?你的意思是我需要把自己添加为“合作者”吗?当我尝试这样做时,它说:“存储库所有者不能是合作者”,问题是什么?你想达到什么目标?什么不起作用?@Jakuje正如我在问题中所说的:当我执行以下操作时:$git pull origin master返回:它返回:Permission denied(publickey)。致命:无法从远程存储库读取。在编写时,它看起来像是在设置所有这些之前执行的。从
    ssh-vvt发布详细日志git@github.com
    。我也会考虑更新网址>代码>ssh://git@github.com/confusedeer/myiOSapp.git它们都是私有的。好吧,这解释了为什么我看不到它们。你试过我的评论吗?一个新的克隆可能会奏效,因为从技术上讲,它应该写出正确的远程URL。我能够找出解决方案,而不必这样做,这更容易,因为我有许多更改要提交。谢谢ssh://git@github。。应该也能用,很高兴你找到了!