即使在添加SSH密钥之后

即使在添加SSH密钥之后

本文介绍了即使在添加SSH密钥之后,Github上的身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会致命:当我尝试将代码推送到我的回购时发生Authenication Failure。我还在我的github帐户中添加了公钥。当我这样做:
ssh -i [email protected]

我得到
嗨amangupta052 !您已成功通过身份验证,但GitHub不提供shell访问权限。



任何人都可以提供帮助吗?
Thanks $ / $>

解决方案

这取决于您使用的远程网址。



如果 git remote -v 返回:

  https ://github.com/username/reponame 

然后你的ssh设置就没有关系了。但是这是可行的:

  ssh://[email protected]:用户名/ reponame 

另一个原因是与您的私钥相关联:如果它是通过短语保护的,其中包含特殊字符,通常不会工作良好。






要替换名为 origin 的远程,请使用命令:

  git remote set-url origin ssh://[email protected]:username / reponame 

(如关于)



如果您看到了::
$ b

  ssh:无法解析主机名github.com:amangupta052:
名称或服务未知
致命:远程端意外挂起

尝试非scp ssh语法:

  git remote set-url origin ssh://[email protected]/username/reponame 

(注意' / '而不是''after github.com



也许这会起作用,如:

  git remote set-url origin [email protected]:username / reponame 

(类似于scp的语法,但不包含 ssh:// 前缀)

至于,scp语法通常意味着〜/ .ssh / config 文件正常工作/ p>

I get fatal:Authenication Failure when I try to push code to my repo. I've added the public key on my github account as well. When I do : ssh -i [email protected]
I get Hi amangupta052! You've successfully authenticated, but GitHub does not provide shell access.

Can anyone help?Thanks

解决方案

That depends on the remote url you have used.

If git remote -v returns:

https://github.com/username/reponame

Then your ssh setup won't matter. But this would work:

ssh://[email protected]:username/reponame

Another cause is linked to your private key: if it is pass-phrase protected, with a special character in it, that usually don't work well.
See here for other ssh causes of failure.


To replace your remote named origin, use git remote commands:

git remote set-url origin ssh://[email protected]:username/reponame

(as explained in the GitHub help page about changing the rmeote url)

If you see::

ssh: Could not resolve hostname github.com:amangupta052:
     Name or service not known
fatal: The remote end hung up unexpectedly

Try the non-scp ssh syntax:

git remote set-url origin ssh://[email protected]/username/reponame

(note the '/' instead of the ':' after github.com)

Maybe this would have worked, as commented in this blog post:

git remote set-url origin [email protected]:username/reponame

(scp-like syntax, but without the ssh:// prefix)

As I mention here, an scp syntax usually means an ~/.ssh/config file to work properly.

这篇关于即使在添加SSH密钥之后,Github上的身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 00:23