Mac下搭建hexo 并部署到gitcafe node
一、安装brewhomegit
1 ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”
二、安装nodejsgithub
1 brew install node
三、安装hoxonpm
1 npm install -g hexo 2 hexo init 3 npm install
四、安装gitruby
1 sudo brew install git
五、检查并添加ssh key服务器
1 cd ~/.ssh
备份:hexo
1 mkdir key_backup 2 mv id_rsa* key_backup
生成ssh key:ssh
1 ssh-keygen -t rsa -C "xxx@xxx.com"
添加ssh key到gitcafecurl
https://gitcafe.com/account/public_keys测试
测试链接:
1 ssh git@github.com
设置我的信息:
1 git config --global user.name "xxx" 2 git config --global user.email xxx@xxx.com
六、注册gitcafe账号并建立公开项目,项目名和用户名要一致。
用hexo init blog建立项目
编辑blog/_config.yml文件并配置
修改hexo根目录下_config.yml文件(注意备份)
1 #deploy 2 deploy: 3 type: github 4 repository: https://gitcafe.com/your_name/your_name/git 5 branch: gitcafe-pages
七、hexo经常使用代码
初始化新的hexo项目: hexo init
建立新文章: hexo new
构建静态文件: hexo generate (hexo g)
开启本地server进行预览: hexo server(hexo s) 访问localhost:4000进行预览
部署到远程服务器: hexo depoly(hexo d)