Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.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
即使在添加SSH密钥之后,Github上的身份验证也失败_Github_Ssh - Fatal编程技术网

即使在添加SSH密钥之后,Github上的身份验证也失败

即使在添加SSH密钥之后,Github上的身份验证也失败,github,ssh,Github,Ssh,我遇到了致命的问题:当我试图将代码推送到repo时,身份验证失败。我也在我的github帐户上添加了公钥。当我这样做时: ssh-igit@github.com 我明白了 你好,amangupta052!您已成功通过身份验证,但GitHub不提供shell访问。 有人能帮忙吗? 谢谢,这取决于您使用的远程url 如果git remote-v返回: https://github.com/username/reponame 那么您的ssh设置就无关紧要了。但这是可行的: ssh://git@git

我遇到了致命的问题:当我试图将代码推送到repo时,身份验证失败。我也在我的github帐户上添加了公钥。当我这样做时:
ssh-igit@github.com

我明白了
你好,amangupta052!您已成功通过身份验证,但GitHub不提供shell访问。

有人能帮忙吗?
谢谢,这取决于您使用的远程url

如果
git remote-v
返回:

https://github.com/username/reponame
那么您的ssh设置就无关紧要了。但这是可行的:

ssh://git@github.com:username/reponame
另一个原因与您的私钥有关:如果它受密码保护,并且带有特殊字符,则通常无法正常工作。


要替换名为
原点的遥控器
,请使用以下命令:

git remote set-url origin ssh://git@github.com:username/reponame
(如关于中所述)

如果你看到:

ssh: Could not resolve hostname github.com:amangupta052: 
     Name or service not known 
fatal: The remote end hung up unexpectedly
请尝试非scp ssh语法:

git remote set-url origin ssh://git@github.com/username/reponame
(注意
github.com
之后的“
/
”而不是“
”)

也许这会奏效,因为:

(类似于scp的语法,但没有
ssh://
前缀)


因为,scp语法通常意味着一个正常工作的
~/.ssh/config
文件。

好的,那么我的源代码是https,如何获取ssh源代码?很抱歉,我对git真的很陌生。@AmanGupta没问题,我已经编辑了我的答案。用适当的值替换“
username
”和“
reponame
”。好的,我设置了新的原点。我在做git-remote-v时得到了ssh。但是现在,我得到了
ssh:无法解析主机名github.com:amangupta052:名称或服务未知致命:远程端在执行
git push时意外挂起
@AmanGupta是
git remote set url
命令的输出,或者你可以在之后做的
git推送
?@AmanGupta但你接受了答案,这是否意味着
git推送
最终成功了?
git remote set-url origin git@github.com:username/reponame