Ultra-detailed Hexo+githhub page construction process

Source: Internet
Author: User
Tags ssh install node
install node. JS First

Installing node. js in a Windows environment is simple, just download the installation file and execute it on the official website to complete the installation.


Like mine is the Windows 64-bit, directly download the installation, no brain next step, do not need to configure environment variables.
Install git

Go to git website to download the corresponding version according to your computer parameters.

Download complete by entering git version at the command line to see if the installation is successful, there is an output version number that indicates the installation was successful.

The Mouse mail menu is more git GUI here and git bash here two buttons, one is the graphical interface of the git operation, one is the command line, we choose Git bash here.


Installation Tutorial: How to install git under Windows

Git Getting Started Tutorial: Pro git (Chinese version)

GIT basic operations: Hexo

Hexo is a fast, concise and efficient blog framework. Hexo uses Markdown (or other rendering engines) to parse articles, and in a matter of seconds, you can generate static Web pages with beautiful themes.
First, install the Hexo

Desktop right mouse, click Git Bash here, enter NPM command to install

NPM Install hexo-cli-g
npm install hexo-deployer-git--save

The first sentence is to install Hexo, the second sentence is to install Hexo deployment to git page deployer, two need to install.

The installation is complete as shown below.


Second, Hexo initialization configuration

Create a Hexo folder

After the installation is complete, create a directory according to your preference (such as F:\Blog\Hexo), go directly to the F:\Blog\Hexo folder right mouse button, click Git Bash here, go to the git command box, do the following.

$ HEXO Init
When the installation Hexo is complete, Hexo will create the required files in the specified folder. The directory under the Hexo folder is as follows:


Local View Effects

Execute the following statement, and then log in localhost:4000 to see the effect

Hexo Generate
Hexo server
Log in to localhost:4000 and see the local effects as follows:


Deploy your blog to a GitHub page

Now the local blog has been set up, but we can only view our blog via a local connection. So what we need to do now is to post the local blog to the server so that others can connect to our blog, and GitHub pages has done it for me. But the code for GitHub pages is stored on GitHub. So next we need to create a new project on GitHub.
First , register your GitHub account to visit the GitHub home page, click Sign up in the upper-right corner to register your own account Ii. create a code base

After registering for the login, we create our own GitHub pages project. Click New Repository.
Third, configure SSH key

Configuring the SSH key for GitHub allows the local git project to connect to the remote GitHub, allowing us to synchronize the local code base with the GitHub code base directly from the git operation after writing the code locally. The operation is as follows: first step, see if there is an SSH key (keys)

First, we need to see if we can see if there is an SSH keys, open git Bash, and run:

Check your native user's home directory for the presence of. SSH Directory

If this directory does not exist, then take the second step, otherwise, you already have the SSH public key and private key, you can skip the second step, directly into the third step operation. second step, create a pair of new SSH keys (keys)

$ssh-keygen-t rsa-c "your_email@example.com"
#这将按照你提供的邮箱地址, create a pair of keys
generating public/private RSA key pair.
Enter file in which to save the key (/C/USERS/YOU/.SSH/ID_RSA): [Press ENTER]

Direct carriage return, the key is stored as the default file. You can also enter a specific file name, such as/c/users/you/.ssh/github_rsa

Then, according to the prompt, you need to enter the password and confirm the password (here, if you are very relieved, actually can not use the password, is to lose the password place, all directly enter, so each push will just enter the line. The so-called safest password, is no password haha). The instructions are as follows:

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
After the input is complete, the screen displays the following information:
Your identification has been saved In/c/users/you/.ssh/id_rsa.
Your public key has been saved in/c/users/you/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
step three, add your public key to your GitHub account

Run the following command to copy the contents of the public key to the system Pasteboard (clipboard).

Clip < ~/.ssh/id_rsa.pub

Then: Log on to GitHub and enter your account Settings.

2. Select SSH Keys


3. Paste the key and add it


Fourth step, test

You can enter the following command to see if the settings are successful, and do not modify the git@github.com section:

$ ssh-t git@github.com
If this is the following feedback:
The authenticity of host ' github.com (207.97.227.239) ' can ' t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Is you sure want to continue connecting (yes/no)?
Don't be nervous, just enter yes, and you'll see:
fifth step, set up user information

Now that you can link to GitHub via SSH, there are some personal information that needs to be perfected. Git logs submissions based on the user's name and mailbox. GitHub is also using this information to do the processing of permissions, enter the following code for personal information settings, the name and mailbox to replace your own, the name according to their own preferences to take, rather than GitHub nickname.
fifth step, set up user information

Now that you can link to GitHub via SSH, there are some personal information that needs to be perfected. Git logs submissions based on the user's name and mailbox. GitHub is also using this information to do the processing of permissions, enter the following code for personal information settings, the name and mailbox to replace your own, the name according to their own preferences to take, rather than GitHub nickname.

$ git config--global user.name "Ryanlijianchang"//user name
$ git config--global user.email  "liji.anchang@163.com"/ /Fill in your email
Sixth step, SSH key configuration succeeded

This machine has been successfully connected to GitHub. iv. Update the local Hexo file to the GitHub library first step, login to GitHub to open your own project Username.github.io
after the second step, open, click SSH, select SSH type address

step Three, copy the address

Fourth, open the Hexo folder you started creating (such as F:\Blog\Hexo), and open the _config.yml file under the folder with Notepad

The fifth step, make the following changes in the configuration file, save

Sixth step, execute under Hexo folder:

Hexo g
Hexo D
or execute directly
Hexo g-d

Once executed, you'll be asked to enter your GitHub account number and password, and you'll be able to log in to our own blog on the GitHub pages server when you're done. The corresponding address is Username.github.io (mine is: Ryanlijianchang.github.io).

If this time, error error Deployer not found:git, then is your Deployer not installed successfully, you need to perform the following command to install again:

NPM Install Hexo-deployer-git--save

In this way, you execute Hexo g-d and your blog is deployed on GitHub. Seventh Step, enter your homepage address on the browser

On the browser, enter the outer chain that GitHub Pager generates for us (for example, my: https://zongbinai.github.io/, and all you need to do is to replace the Zongbinai in this link with your GitHub user name, Because my username is this) you can see your blog.

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.