Introduction to the Construction Process

  1. Install git
  2. Install nodejs
  3. Install hexo
  4. Register a Github account and create a repository
  5. SSH Configuration
  6. Deploy Hexo to Github
  7. Published articles
  8. Common commands of Hexo

Install Git

1. Download

Go to git-scm.com/downloads to download…

I use Windows

2. Install

After downloading, go to Next

3. Check whether Git is installed successfully

Enter git in a CMD window (win+r)

usage: git [--version] [--help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]  [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] [--super-prefix=<path>] [--config-env=<name>=<envvar>] <command> [<args>] These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink restore Restore working tree files rm Remove files from the working tree and from the index sparse-checkout  Initialize and modify the sparse-checkout examine the history and state (see also: git help revisions) bisect Use binary search to find the commit that introduced a bug diff Show changes between commits,  commit and working tree, etc grep Print lines matching a pattern log Show commit logs show Show various types of objects status Show the working tree status grow, mark and tweak your common history branch List, create, or delete branches commit Record changes to the repository merge Join two or more development histories together rebase Reapply commits on top of another base tip reset Reset current HEAD to the specified state switch Switch branches tag Create, list, delete or verify a tag object signed with GPG collaborate (see also: git help workflows) fetch Download objects and refs from another repository pull Fetch from and integrate with another repository or a local branch push Update remote refs along with associated objects 'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific  subcommand or concept. See 'git help git' for an overview of the system.Copy the code

Or right click on the desktop to see the bash here option, where git installation is complete.

Step2: download and configure nodejs

1. Download

I use NVM version management tool, NVM is node.js version management tool, can run on a variety of operating systems. NVM for Windows is software written in the GO language. My computer is running Windows, so I want to record the installation and use of NVM on this operating system.

Nvm-windows latest download: github.com/coreybutler…

2. Install

After downloading, go to Next and check whether the installation is successful in CMD (win+ R)

Running version 1.1.7. Usage: NVM arch: Show if node is Running in 32 or 64 bit mode. NVM install <version> [arch] : The version can be a node.js version or "latest" for the latest stable version. Optionally specify whether to install the 32 or 64 bit version (defaults to system arch). Set [arch] to "all" to install 32 AND 64 bit versions. Add --insecure to the end of this command to bypass SSL validation of the remote download server. nvm list [available] : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls. nvm on : Enable node.js version management. nvm off : Disable node.js version management. nvm proxy [url] : Set a proxy to use for downloads. Leave [url] blank to see the current proxy. Set [url] to "none" to remove the proxy. nvm node_mirror [url] : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url. nvm npm_mirror [url] : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url. nvm uninstall <version> : The version must be a specific version. nvm use [version] [arch] : Switch to use the specified version. Optionally specify 32/64bit architecture. nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode. nvm root [path] : Set the directory where nvm should store different versions of node.js. If <path> is not set, the current root will be displayed. nvm version : Displays the current running version of nvm for Windows. Aliased as v.Copy the code

3. Install the nodejs

Here I use 14.15.1. Run NVM install 14.15.1 in CMD and use NVM use 14.15.1 after the installation

K@DESKTOP-D8R26GT MINGW64 /e/blog $NVM list * 14.15.1 (Currently using 64-bit executable) 10.20.1 K@DESKTOP-D8R26GT MINGW64 /e/blog $NVM use 14.15.1 Now Using node v14.15.1 (64-bit)Copy the code

Please learn how to use NVM by yourself. The node and NPM have been installed here

#step3: Install hexo

First create a folder, name it as you want, my name is Blog, this folder will be used to store all the files you create blog. This file is also called the root directory.

1. Install hexo

Right-click git bash under the blog folder (the folder you created) and the command window will pop up. Or (win+r) type CMD and CD to the blog folder you created.

Enter in the window:

npm install -g hexo-cli
Copy the code

Waiting for the installation

2. Check whether the installation is complete

hexo -v
Copy the code

The results show:

The Hexo installation is now complete

3. Initialize the URL

Continue typing in the window

hexo init
Copy the code

4. Install dependencies

Continue typing in the window

npm install
Copy the code

When finished, the folder will appear

Here’s an explanation:

  • Node_modules: depend on the package
  • Public: stores the generated page
  • Scaffolds: Some templates for generating articles
  • Source: For storing your articles
  • Themes: the theme
  • _config.yml: Configuration file for the blog
  • Db. Json: source parsing results
  • Package. json: configuration information of the module project required by the project

5. Generate static web pages and enable local services

Hexo g// Generate static url hexo s// start local serverCopy the code

To view your local blog page, type http://localhost:4000 into your browser.

# Step4-5: Please baidu by yourself

# Step6: Deploy Hexo to Github

1. Modify the configuration file

This step is to associate hexo with Github and find _config.yml under your Blog root (mine: Blog), which you can open with Notepad and find at the bottom:

deploy:  type: git  repo: [email protected]:camileK/camileK.github.io.git   branch: master
Copy the code

In repo yourname is your username. It can also be obtained as follows:

Note: There is a space after all: in the configuration file, there is no error

2. Start deployment

To do this, you need to install deploy-git, or the deploy command, so that you can deploy to GitHub using the command. Enter git bash in your root directory:

npm install hexo-deployer-git --save
Copy the code

Then type:

hexo cleanhexo ghexo d
Copy the code

Note: Typing hexo d may sometimes prompt you to enter username and password.

In your Github repository, you will find the same files as in your root directory that have already been deployed to your Github repository.

IO, please enter your github username. Github. IO to access your blog.

#step7: post

To understand the markdown syntax, a personal custom is to create an MD file under \source_posts in the root directory of your blog by executing the following command:

hexo cleanhexo ghexo d
Copy the code

You can see our blog when you’re done

#step8: hexo common command

Hexo clean // Clean cache hexo g // Generate new data hexo d // Deploy hexo s // Start local service preview NPM install hexo -g // Install Hexonpm update hexo -g // Upgrade hexo init # initialize blog hexo server -p 5000 # change portCopy the code

So far, Hexo blog has been set up. If you need to change the theme, please use Baidu.

Image loading problem

Blog.csdn.net/qq_36408085…