Hexo(2)-Git托管静态页面-Mac
2016-06-08 本文已影响70人
viggoz
我的博客:www.viggoz.com

1. 安装Git工具包
上一个教程已经安装过就忽略
2. 注册github账号
这里不做过多解释
3. 终端创建ssh
打开 Terminal,(不知道终端在哪儿的,就直接在spotlight里搜terminal)
分别键入代码:
cd ~/.ssh
ssh-keygen -t rsa -C xxxxx@gmail.com(注册github时的email)
按三次回车
4. 查看ssh
分别键入代码:
cd ~/.ssh
LS
cat id_rsa.pub

下面那一堆就是生成的ssh。从‘ssh-rsa’开始 你的邮箱结束。圈选复制。
5. 在github中添加ssh

登录Github-->点你的头像-->点Setting-->点击SSH and GPG keys-->New SSH key
’Title‘随便填. ’Key‘粘贴你刚复制的那长串
Add SSH key
5. 上传你的博客
接下来就可以上传你的代码了
在github下New repository。Create a New Repository如下:

注:github开源项目也就是Public不收费,私有项目也就是Private是收费的.
创建成功出现如下图

复制那个HTTPS网址
6. Hexo配置文件
打开桌面创建的博客目录,打开根目录下的_config.yml文件

按照刚才复制的https://github.com/ViggoZ/xxxxx.github.io.git
修改最下面的 'deploy'参数
**注意!!!冒号后面空格不能少. **
deploy:
type: git
repository: https://yourName:*********@github.com/ViggoZ/xxxxx.github.io.git
branch: master
’yourName‘为你的github用户名, ‘*********’为登录密码
保存关闭
7. 终端上传你的博客
cd Desktop/Hexo1
hexo g
hexo d
电脑输入网址xxxxx.github.io
END