0%

用github.pages和Hexo搭建个人博客

最近深感进步速度太慢,希望能养成写博客的习惯,不断总结学习。
之前都是想在 Atom 上本地写写,后来用手机或者在别的地方看起来不方便,于是决定自己用比较现成的 github.pages+Hexo 解决,顺便玩玩 github。

基本的搭建过程网上教程一大把,不在赘述,也没啥技术含量,主要记录个人遇到的几个坑

  1. Repository name 一定要是 username.github.id

  2. 生成ssh-key的时候,因为之前gitlab上用了一套,然后开始以为不能用同一个,就找了条命令:ssh-keygen -t rsa -C "xxx@xxx.com" -f ~/.ssh/github(后来发现默认的命令也会让你填写保存的文件名称),然后发现没卵用…仍然是 permission denied

  3. 然后看到人说是 root 用户的问题,看了下自己用的,果然是 root 用户,马上切回到普通用户,生成一遍,还是不行…

  4. 再回头翻了翻 github 的帮助,发现可以不用生成新的 key:

    1、Start the ssh-agent in the background.
    $ eval “$(ssh-agent -s)”
    $ Agent pid 59566
    2、Add your SSH key to the ssh-agent. If you are using an existing SSH key rather than generating a new SSH key, you’ll need to replace id_rsa in the command with the name of your existing private key file.
    $ ssh-add ~/.ssh/id_rsa

  5. 终于搞定基本的连接,开始搭Hexo,deployer的时候,出现了错误:error deployer not found:git
    在 v2ex 上找到了解决办法:搭建 hexo,在执行 hexo deploy 后,出现 error deployer not found:github 的错误

    npm install hexo-deployer-git –save 改了之后执行,然后再部署试试

    顺便安利下这个 v2ex 还是个挺不错的程序员社区

  6. 搞了大半夜折腾了个 Next.mist 主题…我发誓再也不做美化界面的事…