Build Hexo Blog under Mac

Source: Internet
Author: User
Tags install node

First, preface

Hexo is a fast, concise, and node-based powerful framework.

(1) Ultra-fast speed: node. JS brings an ultra-fast build speed, allowing hundreds of pages to render instantly in seconds.

(2) Support Markdown:hexo supports all features of GitHub flavored Markdown, and can even integrate most of the octopress plugins.

(3) One-click deployment: Only one instruction can be deployed to GitHub Pages, Heroku or other sites.

(4) Rich plug-ins: Hexo has a powerful plug-in system, install plug-ins can let Hexo support Jade, Coffeescript.

Second, the environment construction

(1) Install node. js, download the website directly.

(2) Install Xcode with git or terminal input under installation Git,mac (I use homebrew here)

sudo brew install git

Third, GitHub related

(1) Register your GitHub account (not much)

(2) Create a new warehouse

It is important to note that the name of the newly created warehouse must be Username.github.io. For example, my username is ericcjj, so the name of the warehouse is EricCJJ.github.io.

(3) Configure SSH Key (can not be configured, you do not have to lose each time the user name and password)

CD ~
LL-ACD. sshll-a

Check whether the Id_rsa.pub or id_dsa.pub file already exists in the list of files in the terminal output, and if the file already exists, go directly to step (4)

There is no need to worry, now we have to build an SSH Key. Enter the following command at the terminal:

" [email protected] "

A mailbox is a mailbox registered for GitHub. Press ENTER, let you enter the file name, the direct return will create a file with the default file name (the default file name is recommended), and then you will be prompted to enter two password, can be empty, directly enter the line.

(4) Add SSH key to GitHub

If you do not specify a file name (that is, the default file name used), then your. SSH folder should have a id_rsa.pub file, open the file, and copy the text inside. Log on to GitHub, click on the avatar to open settings, then click SSH and GPG keys, then click on New SSH Key,tittle to write, and then paste the content you just copied into the key.

(5) Detect if SSH key is configured successfully

Terminal Enter the following command

ssh-t [email protected]

If the following appears:Are you sure you want to continue connecting (yes/no)? 直接yes就行

      最后出现:Hi ericcjj! You've successfully authenticated, but GitHub does isn't provide shell access. The instructions were successful.

Iv. installation of Hexo

(1) terminal input the following command

sudo npm install-g Hexo

(2) Create a folder anywhere, for example: HEXO,CD to the path, execute the command:

sudo hexo init

(3) Install dependent packages

sudo npm Install

(4) Execute in the corresponding folder

sudo hexo g
sudo hexo s

You can view it in the browser by typing http://localhost:4000/. This blog is local, inaccessible to others, and then we need to deploy to GitHub.
Sync your local blog to GitHub

(1) Edit the Deploy node in the _CONFIG.YML in the local blog folder that you created (this is mine, I'll do it myself)

Deploy:  type:git
  Repository:https://github.com/ericcjj/ericcjj.github.io.git
  Branch:master

Note: the ":" In any location in the Hexo configuration file should be followed by a space, or it will be an error.

(2) Install plug-in

sudo npm install hexo-deployer-git--save

(3) Finally execute the following command

Hexo Cleanhexo Generatehexo Deploy

You can access your blog by typing Https://username.github.io in the browser.

Vi. PostScript

Hexo also has a lot of good-looking theme, here to everyone to explore it, you can refer to this, we hope to help.

Build Hexo Blog under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.