我的博客: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