在尝试部署网站到Github和Gitcafe的时候,一直出现以下问题。

1
2
3
4
5
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/do
cs/troubleshooting.html
JS-YAML: bad indentation of a mapping entry at line 75, column 8:
repo:
^

尝试了各种解决方案

  1. 方案一
    在repo:冒号后面加一个空格变成

    1
    2
    3
    repo: #<-#前面有一个空格 
    github: git@github.com:rtafip/rtafip.github.io.git
    gitcafe: https://gitcafe.com/rtafip/rtafip.git

    还是报相同的错误

  2. 方案二
    将repo:git@github.com:rtafip/rtafip.github.io.git使用双引号包住

    1
    2
    3
    repo: 
    github: "git@github.com:rtafip/rtafip.github.io.git"
    gitcafe: https://gitcafe.com/rtafip/rtafip.git

    还是提示相同的问题

……
……
……

最后要都要抓狂了才找到解决方案
原来的代码是这样的

1
2
3
4
5
deploy:
type: git
repo:
github: git@github.com:rtafip/rtafip.github.io.git
gitcafe: https://gitcafe.com/rtafip/rtafip.git

最后的代码是这样的

1
2
3
4
5
deploy:
type: git
repo:
github: git@github.com:rtafip/rtafip.github.io.git
gitcafe: https://gitcafe.com/rtafip/rtafip.git

看出区别了吗?

原来只是repo前面多了一个空格!!!

YAML真是一种脆弱的格式!多一个空格不行,少一个空格不行,空格位置不对不行。而且我也不知道怎么把这个空格引进来的。最重要是提示的位置不对啊。提示的是冒号后面啊。应该这么提示才对

1
2
3
4
5
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/do
cs/troubleshooting.html
JS-YAML: bad indentation of a mapping entry at line 75, column 8:
repo:
^

替我问候写这个分析工具的人母亲。