Github Https方式push错误”Empty reply from server”


 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
2014-11-19 20:41:30.130 GitHub for Mac Login[2595:326257] AskPass with arguments: (
    "/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
    "Username for 'https://github.com': "
)
2014-11-19 20:41:30.200 GitHub for Mac Login[2596:326280] AskPass with arguments: (
    "/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
    "Password for 'https://tcitry@github.com': "
)
fatal: unable to access 'https://github.com/tcitry/tcitry.github.io.git/': Empty reply from server
(128)

解决方法如下:

SSH 密钥的问题?打开终端测试 SSH KEY
ssh -T git@github.com
如果没显示 ” Hi …! You’ve successfully authenticated … ” 之类的,那么就是 SSH KEY 的问题。如果是密钥问题,则可这样做

解决办法

  1. 查看本机是否有 SSH KEY
  2. 新建 SSH KEY
  3. 将新密钥添加到 github

具体做法

Finder 进入 .SSH 文件夹
cmd + shift + g ,输入 .ssh 进入 .ssh 文件夹
或直接打开终端用命令行查看密钥
ls -al ~/.ssh
应该会有一个 id_rsa.pub 文件
如果没有,在终端运行 ssh-keygen -t rsa 以生成之

打开新终端 pbcopy < ~/.ssh/id_rsa.pub
打开你的 github 主页,打开 Add SSH key 的页面 https://github.com/settings/ssh 按照2的做法添加密钥

最后测试ssh -T git@github.com应该会显示 ” successfully authenticated ”

解释

如果之前你设置了 github 的 SSH KEY (在 https://github.com/settings/ssh ),那么如果你电脑上的 SSH KEY 变动(或者被删除了),就会登不上 github。这时需要将当前的 SSH KEY (或重新生成一个 SSH KEY) 添加到 github 上。

我测试了,使用ssh传输方式没问题。有可能最近github又给强了

注意:初始化git的时候,添加远程仓库的地址,选择ssh的地址git remote add origin git@github.com:zzuhan/slider.git

posted @ 2014-12-03 13:46  痴人指路  阅读(4213)  评论(0编辑  收藏  举报