Hexo搭建Github靜態部落格(windows)

來源:互聯網
上載者:User

標籤:

1:註冊好github帳號,建立一個倉庫(倉庫名必須為【your_user_name.github.io】)

2:配置好github ssh-key一般安裝github後都會先配置ssh-key

3:使用npm (先安裝nodejs node官網:http://nodejs.org/)安裝hexo到全域(關於Hexo的安裝配置過程,請以官方Hexo【2】給出的步驟為準)官網地址:https://hexo.io/

4:都配置好後先在你準備存放項目的檔案夾右擊git Bash,然後使用git clone [email protected]:iifred/iifred.github.io.git (這裡改為你自己建立倉庫的地址)擷取倉庫檔案

5:(在上面git bash視窗中繼續輸入)$ hexo init (Hexo隨後會自動在目標檔案夾建立網站所需要的檔案。)然後繼續執行 npm install 會在目錄中安裝 node_modules。安裝完成後就可以執行hexo server來開啟運行項目

http://localhost:4000/  hexo server -p (連接埠號碼)  可以自己指定連接埠運行 

6:本地運行ok後我們就把他同步到github上去,首先我們輸入(在上面git bash視窗中繼續輸入)hexo generate 該命令執行完後,會在 D:\Hexo\public\ 目錄下產生一系列html,css等檔案。

hexo new "My New Post"會在D:\Hexo\source\_posts目錄下產生一個markdown檔案:My-New-Post.md

可以使用一個支援markdown文法的編輯器(比如 Sublime Text 2)來編輯該檔案。

部署到Github前需要配置_config.yml檔案,首先找到下面的內容

# Deployment## Docs: http://hexo.io/docs/deployment.htmldeploy:  type:

然後將它們修改為

# Deployment## Docs: http://hexo.io/docs/deployment.htmldeploy:  type: github  repository: iifred/iifred.github.io.git   branch: master

 注意冒號後面需要空格

配置完成後我們只需要執行這3個命令後就能在http://iifred.github.io/(iifred自己的使用者名稱)看到效果了
hexo cleanhexo generatehexo deploy
加入你在執行deploy沒有效果的時候估計是版本問題
你可以先安裝一個npm install hexo-deployer-git --save
_config.yml檔案中找到deploy:type: git
注意格式!!!
如果還不行的話,就自行百度把。
如:http://www.v2ex.com/t/175940
可以使用hexo -version查看你的版本
其他的更多關於Hexo設定 啪啪啪,下集更精彩!!

Hexo搭建Github靜態部落格(windows)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.