:::
6-3 將 Hexo放上GitHub
- 安裝 Hexo Git
npm install hexo-deployer-git --save--save表示將安裝的包加入依賴列表的意思,可以看下package.json 裡的dependencies字段。 -
安裝所有依賴
npm install - 先至GitHub建立新專案,專案名稱請取成「
用户名.github.io」,例如「tad0616.github.io」

- 如果從來沒有設定過git,請執行
git config --global user.name "您的GitHub帳號" git config --global user.email "的GitHub註冊信箱" - 然後生成ssh金鑰
ssh-keygen -t rsa -C "您的GitHub註冊信箱"如果在VSCode無法執行,請直接從開始選單開啟Git→Git Bash來執行
- 執行後會在使用者目錄下產生金鑰,如:
C:\Users\使用者\.ssh\id_rsa.pub - 開啟
id_rsa.pub並複製其內容,到 https://github.com/settings/keys 去新增一組金鑰設定,並將其內容貼上 - 編輯Hexo的全域設定檔:
blog/_config.yml,設定最下方的deploy:deploy: type: git repo: git@github.com:tad0616/tad0616.github.io.git branch: master - 產生檔案
hexo g - 執行佈署指令,將內容送上github
hexo d - 也可以同時產生檔案並執行佈署指令
hexo g -d
6-2 建立文章