git Github 身份验证失败 - ... GitHub 不提供 shell 访问

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26953071/
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-09 02:40:14  来源:igfitidea点击:

Github Authentication Failed - ... GitHub does not provide shell access

gitgithubssh-keys

提问by Lut

$ git remote add origin [email protected]: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.

My keys were added succesfully

我的密钥已成功添加

 $ ssh -T [email protected]
 Hi lut! You've successfully authenticated, but GitHub does not provide shell access.

The Github article https://help.github.com/articles/generating-ssh-keys/says that "Shell access" should not be an issue? What could the problem be?

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

回答by VonC

Try and redefine the ssh url for remote origin:

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

git remote set-url origin [email protected]:lut/EvolutionApp.git

And try again

然后再试一次

回答by bSaraogi

You might have to add the remote again. That error message happens when Git doesn't know where to push to.

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

Use git remote -vcheck if the remote exists, if not, add it.

使用git remote -v检查遥控器是否存在,如果不存在,则添加它。

Even then if it doesn't work try removing the GIT_SSHenvironment variable, this maybe causing the problem.

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

回答by SLaks

This can happen if you have an incomplete remote entry in your global config.

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

Run git config -e --system, comment out any [remoteentries, re-add the remote, and try again.

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

回答by Ymin Hu

check if you are using httpsas remote url instead of ssh. I set my remote url to httpand encountered this issue. After resetting the url to sshprotocol the problem is gone.

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