問題
在使用 hexo d
部署博客和使用 Git/Github 進行 git push -u origin master
時遇到了以下問題:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master
Pushing to git@github.com:MaugerWu/MaugerWu.github.io.git
Connection reset by 192.30.253.113 port 22
fatal: sha1 file '<stdout>' write error: Broken pipe
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
解決
這表明 git 軟件無法通過 SSH 連接到 Github:如果您的防火牆或 ISP 設置的防火牆阻止端口 22 上的 SSH 連接,通常會發生這種情況。一個快速的解決方法,嘗試 Github 提供的HTTPS URL:
git remote add origin-https https://github.com/github.com:MaugerWu/MaugerWu.github.io.git
git push -u origin-https master
如果可以,那肯定是你的SSH端口被關閉了。 您可以繼續使用此替代語法,嘗試在您的計算機或 ISP 上取消阻止端口 22,或查看建議:http://stackoverflow.com/a/8081292/27310 。