在进行git推送时,github上的ssh登录问题和身份验证问题

时间:2011-04-18 13:28:04

标签: git ssh github

当我执行ssh git@github.com

时,我遇到了以下问题
PTY allocation request failed on channel 0

在此之后,通常我们会收到一条确认消息,说明您已通过身份验证,但我没有收到

我尝试重新启动问题 现在我已经替换了我的ssh密钥(这不是解决方案)并再次尝试但没有帮助

每次我做一次

git push origin master

在github上: 它提示

Username: 
Password:

同样有功能

git push origin master

我得到了答案

fatal: protocol error: expected sha/ref, got '
     

---------------------------------------------- The git://协议是只读的。

     

请使用上面列出的推送网址   存储库页面。   ----------------------------------------------'

此部分已解决

  

再次当我做

~/.ssh> ssh-add id_rsa 
     

我明白了 -

 Could not open a connection to your authentication agent

2 个答案:

答案 0 :(得分:4)

启动ssh-agent后再试一次。 (应该解决2.问题)

答案 1 :(得分:4)

  

git://协议是只读的。

这应解释很多问题。您使用了只读URL而不是读写URL。

实施例。我克隆了apt-offline的github repo,然后做了一个

  

$ git remote show origin

显示

* remote origin
  Fetch URL: git@github.com:manish/apt-offline2.git
  Push  URL: git@github.com:manish/apt-offline2.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

查看git@github.com:manish/apt-offline2.git 这是我的读写git URL

如果我使用

的只读网址克隆它
  

git clone git://github.com/manish/apt-offline2.git

然后,这将更改为git://github.com/manish/apt-offline2.git,任何推送尝试都会产生错误

所以你需要提供命令的输出

  

$ git remote show origin

如果您的默认遥控器是原点。要检查所有遥控器,您可以使用命令

  

$ git remote


<强>注意

不要编辑.git目录。如果远程remotename错误,那么

删除远程使用

  

$ git remote rm remotename

然后添加

  

$ git remote add remotename URL