之前寫(xiě)了一篇在Coding上搭建Hexo博客,現(xiàn)在來(lái)寫(xiě)同時(shí)在GitHub和Coding上搭建Hexo博客。
在GitHub上搭建Hexo博客跟在Coding上差不多,但還是有點(diǎn)細(xì)微差別。這里主要介紹下區(qū)別,詳細(xì)的參考在Coding上搭建Hexo博客
在GitHub上創(chuàng)建名為username.github.io的倉(cāng)庫(kù)(repository),username就是你的用戶(hù)名,倉(cāng)庫(kù)名要按照這種形式,這是固定格式。
-
創(chuàng)建好倉(cāng)庫(kù)之后修改_config.yml里面的配置
deploy: type: git repo: git@github.com:username/username.github.io.git branch: master -
執(zhí)行下面命令,遇到問(wèn)題可以到在Coding上搭建Hexo博客里面找
hexo g hexo d 在GitHub上搭建Hexo就好啦,打開(kāi) https : // username.github.io /就可以訪(fǎng)問(wèn)自己的博客啦~
-
現(xiàn)在分別在GitHub和Coding上搭建好博客了,要想同時(shí)搭建,只需要修改_config.yml里面的配置
deploy: - type: git repo: git@github.com:username/username.github.io.git branch: master - type: git repo: git@git.coding.net:username/username.git branch: master 注意前面的符號(hào)-后面有一個(gè)空格,不要漏了,我自己就因?yàn)槁┝藢?dǎo)致折騰了半天~~~
寫(xiě)下來(lái)才覺(jué)得很簡(jiǎn)單,可是在搭建過(guò)程中真的是踩了好多坑,因?yàn)閾Q了另一個(gè)賬號(hào)重新完整再搭一遍,導(dǎo)致切換的時(shí)候有些配置沒(méi)改,比如.ssh里的~
對(duì)啦,有時(shí)候步驟全對(duì)了可就是沒(méi)成功,也不一定就是自己方法錯(cuò)了,最后希望各位小伙伴都能搭好屬于自己的博客~