Build the hexo blog and deploy it on github to build the hexo blog github

Source: Internet
Author: User
Tags install node using git

Build the hexo blog and deploy it on github to build the hexo blog github

I have been thinking about how to build my own blog over the past few days. Accidental access to hexo

Hexo is a fast, simple, and powerful blog framework driven by Node. js. It supports multithreading and generates hundreds of articles in just a few seconds. Supports markdown to write articles, allowing you to easily generate static Web pages hosted on github.

It feels good.

Front-end staff are sharing their code with github. So I want to use hexo to deploy it on git. Create your own blog.

1. Install hexo

Before installing hexo:

Install Git

Download msysgit and execute it to complete the installation.

Install node. js

It is very easy to install Node. js in a Windows environment. You only need to download the installation file and execute it to complete the installation.

Install hexo:

Use the npm command to install the SDK. (Right-click anywhere and select Git bash)

npm install -g hexo

Create an hexo Folder:

After the installation is completeH:\hexo), Execute the following commands (inH:\hexoRight-click inside and select Git bash), Hexo will automatically create all the files required for the website in the target folder.

hexo init

Install dependency packages

npm install

Start local services

Now we have set up a local hexo blog and run the following command:H:\hexo), And then enter it in the browser.localhost:4000Look.

hexo generatehexo server

Now, the local blog has been set up, but it is local. No one else can see it,

Next we will deploy the blog on github.

 

Register a Github account.

Skip if it already exists.

You don't need to introduce it here.

Create repository

After logging on to github, click "+" in the upper right corner of github, select "New repository" from the drop-down menu, and enter the library name on the following page, check "Initialize this repository with a README" and click "create repository" to create a database.

 

 

Deployment

Edit_config.yml(InH:\hexo). During deploymentzipperaChange to your account name.

deploy:  type: github  repository: https://github.com/xiaomiya/xiaomiya.github.com.git  branch: master

Run the following commands to complete the deployment.

hexo generatehexo deploy

Note: Some new users need to set up ssh; otherwise, the above command will fail. For the introduction and Setup of ssh, please refer to the official tutorial. Don't worry, it's very simple.

Remember: every time you modify a local filehexo generateTo save. Every time you use a commandH:\hexoDirectory.

Okay, our blog has been fully built and accessed in a browserzippera.github.ioYou can see your achievements!

Another point is that some users have this prompt after hexo deploy.



 

Enter the email address we have verified on git.



 

Such as this. Again hexo deploy

It is released.

We can see that we have achieved success...

Bugs
  1. Some netizens do not reply to the shortcut menugit bashOption, which can be found in the Start Menugit bashAnd thencdGo to the corresponding directory to execute the command.
  2. After the deployment of github is complete, the 404 error may occur immediately. This is normal. (a maximum of 10 minutes can be accessed. If not, it is likely that the verification email sent to you by github has not been opened. According to multiple parties, it will be okay after verification.
  3. Ifhexo dLaterfatal: 'username.github.io' does not appear to be a git repositoryFirst, check whether the repo name complies with the specifications, whether it contains uppercase letters, and whether the deploy configuration in config. yml is correct. Second, disable git bash, re-open it, and execute the command.
  4. Some may not be in the IT industry, or may not know much about shell commands. When a password is required, the password is not displayed for security purposes, not for your failure.
  5. Do not use notepad in windows to open and edit files. sublime text is recommended, which is very simple. If you have already edited it in notepad, use sublime text to transcode it to utf8 」.
  6. When installing hexo, it is possible that the network is not powerful and the global break wall is good.
  7. If you have any other problems, delete. deploy and db. json and generate a new one.

 

Tips

Hexo now supports simpler command formats, such:

hexo g=hexo generate

hexo d=hexo deploy

hexo s=hexo server

hexo n=hexo new

 



How to write a blog on octopress github?

This article is successfully tested in Windows 7.

Install and set Git

Download Git
For Windows, use the default installation. After installation, you can use Git locally.

To put the content on Github, you must first register an account on the Github website, and then create an SSH Key using Git on the local machine. The procedure is as follows:

Run the following command on Git Bash:
Ssh-keygen-C "username@email.com"-t rsa

Note: The username@email.com needs to be replaced with the Email address or Username you registered on Github

This will generate a. ssh folder under the user directory (C: \ Users \ User Name), which contains the corresponding SSH
Keys, where id_rsa.pub is the SSH public key file required by Github.

Go to the c: \ Users \ User Name \. ssh \ directory and find id_rsa.pub (the location may not be correct, but make sure it is a file ending with. pub). Open and copy all the content in notepad.

Note: It is recommended that the name of the private key should be "id_rsa", so that this file will be found when you connect to Github. If the file name is set, you can rename the file later.

On the github website, choose "Account Settings"> "SSH Public Keys"> "Add another ".
Public key, paste the copied content into the key text box.

In this way, you can directly use Git and GitHub.

Note: It is recommended to enter "ssh-v git@github.com" in Git Bash to test normal connection to github

Install the Ruby Environment

Download RubyInstaller and DevKit.

.

Install RubyInstaller first, and decompress DevKit (the path cannot contain Chinese characters ).

In the "Start Command Prompt with Ruby" Command line, enter the DevKit decompression directory, and then run the following Command:
Ruby dk. rb init
Ruby dk. rb install
Gem install rdiscount -- platform = ruby

If the installation is successful, you can use some Ruby tools and provide a basic environment for building a blog later.

Install Octopress

First clone an Octopress file from Github through Git (enter the command on Git Bash)
Git clone git: // github.com/imathis/octopress.git octopress

Then install some dependent tools (entered in Start Command Prompt with Ruby later)

Cd octopress
Ruby -- version # shocould report Ruby 1.9.2
Gem install bundler
Bundle install

Install Octopress's default Theme

Rake install

Configure Octopress

Change the _ config. yml encoding in the octopress folder to the UTF-8:

Select the encoding format as UTF-8 when saving (or saving)

Modify _ config. yml to correct url, title, subtitle, autho ...... the remaining full text >>>

How can I help myself after GitHub is unavailable in China?

It is damaged. Both the offline git server and the recommended git server are uncomfortable. Can I build github by myself? Or are there any alternatives available? The wall is not stable. For technical discussion only, try not to discuss other topics. 「 Github confirmed that it has been unblocked yesterday. Most of the DNS in each province in China has been updated. After testing, access to github is normal, and the IP address resolved by DNS is already the correct IP address .」

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.