简体   繁体   English

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

[英]Github Authentication Failed - ... GitHub does not provide shell access

$ 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.

My keys were added succesfully我的密钥已成功添加

 $ ssh -T git@github.com
 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? Github 文章https://help.github.com/articles/generating-ssh-keys/说“Shell 访问”应该不是问题? What could the problem be?问题可能是什么?

Try and redefine the ssh url for remote origin:尝试重新定义远程源的 ssh url:

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

And try again.然后再试一次。

Only git remote set-url can change an existing remote URL (as opposed to git remote add , to add a new remote name and URL)只有git remote set-url可以更改现有的远程 URL(与git remote add相反,添加新的远程名称和 URL)
Here, is issue was the URL of the existing origin: EvolutionApp : it needed to be replaced by a valid one.这里的问题是现有源的 URL: EvolutionApp :它需要被一个有效的替换。
Using git config url."ssh://git@github.com/".insteadOf https://github.com/ would not have helper, considering there was no HTTPS URL in the first place.使用git config url."ssh://git@github.com/".insteadOf https://github.com/不会有帮助,因为首先没有 HTTPS URL。

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 -v check if the remote exists, if not, add it.使用git remote -v检查远程是否存在,如果不存在,添加它。

Even then if it doesn't work try removing the GIT_SSH environment variable, this maybe causing the problem.即使它不起作用,请尝试删除GIT_SSH环境变量,这可能会导致问题。

This can happen if you have an incomplete remote entry in your global config.如果您的全局配置中有一个不完整的远程条目,就会发生这种情况。

Run git config -e --system , comment out any [remote entries, re-add the remote, and try again.运行git config -e --system ,注释掉所有[remote条目,重新添加远程,然后重试。

check if you are using https as remote url instead of ssh .检查您是否使用https作为远程 url 而不是ssh I set my remote url to http and encountered this issue.我将远程 url 设置为http并遇到了这个问题。 After resetting the url to ssh protocol the problem is gone.将 url 重置为ssh协议后,问题就消失了。

You can add this in the ~/.gitconfig file.您可以将其添加到~/.gitconfig文件中。

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

Now ssh will be used instead of https.现在将使用 ssh 而不是 https。

if there is trust issue for android studio or vs code project in git You can give safe permissions like below, with your project path in Ubuntu如果 android studio 或 git 中的 vs 代码项目存在信任问题,您可以提供如下安全权限,项目路径位于 Ubuntu

git config --global --add safe.directory '_your_project_path' git 配置 --global --add safe.directory '_your_project_path'

git config --global --add safe.directory '/data/project/project/MyApp/android_app'

I ran into this error while trying to clone a repo on Cent OS 8.我在 Cent OS 8 上尝试克隆 repo 时遇到了这个错误。

I had to use https instead of ssh to clone and it successfully worked我不得不使用https而不是ssh进行克隆,它成功地工作了

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

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