【问题标题】:Github Authentication Failed - ... GitHub does not provide shell accessGithub Authentication Failed - ... GitHub 不提供 shell 访问
【发布时间】:2015-01-13 04:57:50
【问题描述】:
$ git remote add origin git@github.com:lut/EvolutionApp.git
fatal: remote origin already exists.

$ git push -u origin master
fatal: 'EvolutionApp' does not appear to be a git repository
fatal: Could not read from remote repository.

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

我的密钥已成功添加

 $ ssh -T git@github.com
 Hi lut! You've successfully authenticated, but GitHub does not provide shell access.

Github 文章https://help.github.com/articles/generating-ssh-keys/ 说“Shell 访问”应该不是问题?可能是什么问题?

【问题讨论】:

  • 你从git remote show origin看到了什么?
  • $ git remote show origin fatal: 'EvolutionApp' 似乎不是 git 存储库致命:无法从远程存储库读取。请确保您拥有正确的访问权限并且存储库存在。
  • @SLaks 它说它似乎不是一个 Git 存储库,但之前它说它已经存在。我不明白。

标签: git github ssh-keys


【解决方案1】:

尝试重新定义远程源的 ssh url:

git remote set-url origin git@github.com:lut/EvolutionApp.git

然后再试一次。

只有 git remote set-url 可以更改现有的远程 URL(与 git remote add 不同,添加一个远程名称和 URL)
在这里,问题是现有来源的 URL:EvolutionApp:它需要被一个有效的替换。
考虑到首先没有 HTTPS URL,使用git config url."ssh://git@github.com/".insteadOf https://github.com/ 将没有帮助。

【讨论】:

  • 感谢 VonC。这让我发疯,直到我找到你的帖子。神速。
  • 为什么 github 在他们的文档中不允许 shell 访问?这令人困惑。 help.github.com/articles/testing-your-ssh-connection
  • @brohjoe 因为ssh -T git@github.com 只给您一个“欢迎”消息,不是交互式外壳。
  • @MoshtabaDarzi 很抱歉它不起作用。您能否提出一个包含更多详细信息的单独问题供我或其他人查看?
【解决方案2】:

您可以将其添加到~/.gitconfig 文件中。

[url "ssh://git@github.com/"]
        insteadOf = https://github.com/

现在将使用 ssh 代替 https。

【讨论】:

    【解决方案3】:

    您可能需要再次添加遥控器。当 Git 不知道推送到哪里时,就会出现该错误消息。

    使用git remote -v检查远程是否存在,如果不存在,添加它。

    即使它不起作用,请尝试删除 GIT_SSH 环境变量,这可能会导致问题。

    【讨论】:

    • $ git remote -v origin EvolutionApp (fetch) origin EvolutionApp (push)
    • 终端启动时弹出的这条消息是否会导致问题? -bash: /etc/profile.d/rvm.sh: 没有这样的文件或目录
    【解决方案4】:

    如果您的全局配置中有不完整的远程条目,就会发生这种情况。

    运行git config -e --system,注释掉任何[remote 条目,重新添加遥控器,然后重试。

    【讨论】:

    • $ git config -e --system subl -w: subl: command not found error: there was a problem with editor 'subl -w'.
    • 您的 git 编辑器配置错误。安装 Sublime 或将其配置为使用不同的编辑器。
    • 我运行了 git config --global core.editor "subl -n -w" 但仍然出现错误。我可以通过打开 /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl 从终端成功打开 Sublime 我认为我的个人资料与我的个人资料有关。每次我打开一个新的终端窗口时,我都会得到 -bash: /etc/profile.d/rvm.sh: No such file or directory
    【解决方案5】:

    检查您是否使用https 作为远程网址而不是ssh。 我将远程 url 设置为 http 并遇到了这个问题。将 url 重置为ssh 协议后,问题就消失了。

    【讨论】:

      猜你喜欢
      • 2019-12-29
      • 2021-09-03
      • 2011-03-31
      • 1970-01-01
      • 1970-01-01
      • 2016-11-03
      • 1970-01-01
      • 1970-01-01
      • 2020-07-26
      相关资源
      最近更新 更多