前端小白前端
windows用戶git
懶癌晚期患者github
一個Github帳戶npm
安裝Gitwindows
安裝Node.jsbash
Step 1, 建立一個Github page
Repo name 的填寫格式爲
Github名 + github.io
。舉個栗子,個人repo name爲cnscorpions.github.io
服務器Description能夠寫
static blog/blog
,反正你隨意就好網絡點擊建立repohexo
Step 2, Hexo安裝以配置 (假設你已經安裝好Git和Node.js)
打開Git bash命令行ssh
安裝NPM ---> Taobao NPM 鏡像 (由於網絡環境很差,你懂的)
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
安裝Hexo
$ cnpm install -g hexo-cli
建立blog根目錄
$ hexo init blog
生成靜態文件
$ hexo g
安裝Hexo-server模塊
$ cnpm install hexo-server --save
運行本地服務器 (必定要在blog根目錄下運行)
$ hexo s
打開
http://localhost:4000/
已經能夠看到一篇內置的blog了Step 3, 安裝Hexo主題 (Git在線安裝 VS 本地安裝)
Git安裝
$ hexo clean $ git clone https://github.com/iissnan/hexo-theme-next
修改配置文件
_config.yml/theme ---> next
更新主題
$ hexo c $ hexo g $ hexo s
Step 4, 安裝SSH
安裝hexo-deployer-git模塊
$ cnpm install hexo-deployer-git --save
修改配置文件
deploy: type: git repo: https://github.com/cnscorpions/cnscorpions.github.io.git branch: master
檢查電腦中是否存在SSH key
$ ls -al ~/.ssh
建立新的SSH key
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com" Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter] ---> 不要移動文件位置 Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]
複製id_rsa.pug
複製到Github SSH key
搞定
$ hexo g ---> $ hexo d ----> OVER
PS: 暫時先這樣了,歡迎拍磚!