hexo 部署时遇到的坑

https://hexo.io/zh-cn/docs/

报错spawn git ENOENT

Error: spawn git ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
    at child_process.js:1144:20)
    at process._tickCallback (node.js:355:11)

未添加Git环境变量引起,添加Git与git管理库的环境变量即可;

D:\Git\bin;D:\Git\libexec\git-core

设置完毕后强制更新环境变量,或者重启电脑~

读取不到Git分支

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io
cs/troubleshooting.html
Error: fatal: 'github.com/pyrinelaw/pyrinelaw.github.io.git' does not appear
be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

读取不到github上的分支,使用Hexo之前是有使用Git操作过Github的,所以不大可能是Git安装的问题。

ssh -v [email protected]

显示ssh连接github成功,说明Git安装正确。
卸载Git重新安装,错误继续出现。搁置了一天,中午午休的时候网上逛论坛,发现了此问题。原来是我的Git版本太新的缘故。。。
卸载Git 2.5版本,安装1.9版本,问题解决-_-

处理:
把_config.yml文件中repository: https://github.com/andybroker/andybroker.github.io.git 这个地址改为[email protected]:andybroker/andybroker.github.io.git
把_config.yml中的repository 改了成了ssh,
deploy:
  type: git
  repository: ssh://[email protected]/xiaoliuzi/xiaoliuzi.github.io
  branch: master

猜你喜欢

转载自zhangfa8710.iteye.com/blog/2412599