一、ssh: connect to host github.com port 22: Connection refused

修改.ssh文件夹中的config文件(若没有则新建一个)。在文件中加入

1
2
3
Host github.com
Hostname ssh.github.com
Port 443

二、hexo init 时卡住

hexo init

1
hexo init blog

实际上是运行了如下命令

1
2
3
4
5
git clone https://github.com/hexojs/hexo-starter.git blog
cd blog
git submodule init
git submodule update
npm i

所以,我们可以直接运行如下命令替换原先的hexo init命令,从gitee源做clone

1
2
3
4
5
6
git clone https://gitee.com/weilining/hexo-starter.git blog
cd blog
git submodule init
git submodule update
npm config set registry https://registry.npm.taobao.org
npm i

三、hexo d时报错:ERROR Deployer not found: git

运行以下命令安装hexo-deployer-git插件

1
npm install hexo-deployer-git --save

四、hexo d时报错:spawn failed,无法推送到github

修改_config.yml配置文件

原先为

1
2
3
4
deploy:
type: git
repo: https://github.com/<Name>/<Name>.github.io.git
branch: master

替换为

1
2
3
4
deploy:
type: git
repo: git@github.com:<Name>/<Name>.github.io.git
branch: master