HEXO_Deployment

1.在GitHub建立新的repository

將資料庫命名為username.github.io,username記得改成自己的帳號喔。

像是這樣

2.將資料夾連到GitHub資料庫

在資料庫複製以下三行

1
2
3
git branch -M main
git remote add origin git@github.com:......
git push -u origin main

3.定義GitHub工作流程

輸入以下指令查詢Node,js版本號

1
node --version

開啟vscode

1
2
cd<HEXO所在的資料夾>
code .

HEXO

1.環境設置

安裝HEXO

1
npm install -g hexo-cli

2.初始化HEXO

1
hexo init <資料夾名稱>

或是

1
2
3
mkdir <資料夾名稱>
cd <資料夾名稱>
hexo init

3.在資料夾安裝所需的檔案

完成後cd進入,輸入

1
npm install

4.開啟本地伺服器

1
hexo s

DNS

作為一般使用者,輸入網址之後,電腦需將其轉換成IP位址才能繼續。於是電腦會將網址傳給DNS Server,拿到該Domain Name所對應的IP位置後才能連上網站。

GitHub

1.事前準備

  • 註冊GitHub帳號
  • 確認已安裝Git

2.環境設定

1
2
3
4
5
6
git config --global user.email "your@example.com"
git config --global user.name "Your Name"
git config --global color.ui true
git config --global alias.co commit
git config --global alias.lg "log --color --graph --all --pretty=format:'%Cred%h%Creset
-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"

3.git init

安裝node.js

  • Node.js 提供npm來安裝所需的套件。這裡可以選擇安裝最新的V20.12.2版本,HEXO官網建議使用10.0級以上版本,若不確定已下載了哪個版本可以使用終端機輸入npm versin 查看版本號