天天看點

github分支備份部落格源檔案 - Hexo建站(四)

github分支備份部落格源檔案 - Hexo建站(四)

Hexo建立的部落格的所有檔案, 剛開始是沒有.git檔案夾的.

  1. 首先進入​

    ​.deploy_git​

    ​​目錄下, 建立一個分支​

    ​hexo​

    ​​

    ​git branch hexo​

  2. 然後将該目錄下的​

    ​.git​

    ​檔案夾複制到部落格的根目錄下, 也就是上一級目錄.
  3. 在git bash下操作, 切換到hexo分支.

    ​​

    ​git checkout hexo​

  4. 将根目錄下的檔案先建立索引, 後推送到遠端倉庫的hexo分支上.

    // 将檔案添加到版本庫

    ​​

    ​git add .​

    ​​ // 上傳到版本庫

    ​git commit -m "描述資訊"​

    ​ // 添加遠端推送位址

    ​git remote add <shortname> <url>​

    ​ 舉例: git remote add origin [email protected]:UserName/UserName.github.io.git

    // 将本地倉庫的内容推送到遠端倉庫

    ​git push origin hexo​

.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/