Article directory
- 1. Blog establishment
- 2. Create a new folder new for uploading the hexo blog directory
- 3.Create hexo branch on github and set it as the default branch
-
- Create hexo branch
- Set hexo branch as default branch
- 4. Enter git clone in the newly created folder, and then upload the relevant files to the hexo branch
-
- 1. There should be a .gitignore file in the cloned folder to ignore some unnecessary files, indicating that these types of files do not require git. If not, right-click to create a new one with the following content:
- 2. If you have cloned the theme file, you need to delete the .git in the theme folder. I have deleted the .git directory of the theme here.
- 3. Send the relevant files in the new directory to the remote warehouse hexo branch
- 5. Quickly build a blog environment in the new environment
-
- 1. Set up ssh
- 2. Pull the hexo blog directory
- Problem 1. The nodejs version is too low
-
- Upgrade nodejs
- Problem 2. Hexo blog pictures are not displayed
-
- Create a new imgs folder
- Modify image path
1. Blog establishment
https://yyheroi.github.io/2023/08/25/github + hexo blog construction/
2. Create a new folder new for uploading the hexo blog directory
Copy the following directories (except the directory in the red box) to the new directory
Reference: https://blog.csdn.net/K1052176873/article/details/122879462?ops_request_misc=%7B%22request%5Fid%22%3A%22169457461216800192234994%22%2C%22scm%22%3A%22201407 13.130102334.pc%5Fall .%22%7d & amp; request_id = 169457461216800192234994 & amp; biz_id = 0 & amp; UTM_Medium = Distribute.pc_search_result.none-Blog- 2 all first_RANK_ECPM_V1 ~ RANK_V31_ECPM-122879462-NULL -null.142
3.Create hexo branch on github and set it as the default branch
Create hexo branch
Set the hexo branch as the default branch
4. Enter the git clone in the newly created folder, and then upload the relevant files to the hexo branch
Basic principle: The github warehouse has two branches. The main branch stores static pages generated by hexo. The hexo branch stores the basic Hexo blog project structure and default configuration files, such as articles and themes.
When you need to rebuild the environment, directly pull the Hexo blog directory and related configuration files in the hexo branch.
cd new git clone [email protected]:<username>/<username>.github.io.git #<username> username git branch #View branch, display * hexo
1. There should be a .gitignore file in the folder cloned, which is used to ignore some unnecessary files, indicating that these types of files do not require git. If not, right-click to create a new one with the following content:
.DS_Store Thumbs.db db.json *.log node_modules/ public/ .deploy*/
2. If you have cloned the theme file, you need to delete the .git in the theme folder. I have deleted the .git directory of the theme here
3. Send relevant files in the new directory to the remote warehouse hexo branch
git add . git commit –m add_branch git push
5. Quickly build a blog environment in the new environment
1. Set up ssh
ssh-keygen -t rsa -C '[email protected]' #My own email cat ~/.ssh/id_rsa.pub #Copy the contents to github ->settings ->SSH and GPC keys ->SSH keys ->New SSH key ssh -T [email protected] #After entering yes, your user name will be displayed at the end of the line (you will receive an email reminder if the binding is successful) #Then bind the user name and email address of Github locally (git) git config --global user.name "<username>" #Your own username git config --global user.email '[email protected]' #Your own email
2. Pull the hexo blog directory
git clone [email protected]:<username>/<username>.github.io.git #<username> username git branch #View branch, display * hexo npm install hexo npm install npm install hexo-deployer-git #The hexo init instruction is not required npm i hexo-renderer-marked #UpdateBlog Add new article hello-world hexo new "hello-world" git add . #Back up the article to the hexo branch or git add source/_posts/hello-world.md git commit –m "hello-world" git push #or git push origin hexo hexo g #Generate static page hexo s #Start local server preview hexo d #Deploy the generated blog file to the github main branch, and _config.yml has been set in the Hexo blog project configuration file
Problem 1. The nodejs version is too low
npm WARN notsup Unsupported engine for [email protected]: wanted: {“node”:”>=12.13.0″} (current: {“node”:”10.19.0″,”npm”:”6.14.4″ })
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {“node”:”>=12.13.0″} (current: {“node”:”10.19.0″,”npm”:” 6.14.4”})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {“node”:”>=14″} (current: {“node”:”10.19.0″,”npm”:”6.14.4″ })
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {“node”:”>=12.4.0″} (current: {“node”:”10.19.0″,”npm”:”6.14. 4”})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {“node”:”^14.17.0 || ^16.13.0 || >=18.0.0″} (current: {“node”:”10.19. 0″,”npm”:”6.14.4″})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {“node”:”>=14″} (current: {“node”:”10.19.0″,”npm”:”6.14.4″ })
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {“node”:”>=14″} (current: {“node”:”10.19.0″,”npm”:”6.14.4″ })
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {“os”:”darwin”,”arch”:”any”} (current: {“os”:”linux”,”arch”: “x64”})
Upgrade nodejs
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash #Install nvm source ~/.bashrc #Load nvm nvm install node #Use nvm to install the latest version of Node.js node -v #Verify Node.js version
Problem 2. hexo blog pictures are not displayed
https://blog.csdn.net/QRLYLETITBE/article/details/127737904?ops_request_misc=%7B%22request%5Fid%22%3A%22169459233116800184124470%22%2C%22scm%22%3A%2220140713.13010 2334.pc%5Fall.% 22%7D &request_id=169459233116800184124470 &biz_id=0 &utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-1-127737904-null-nu ll .142
npm i hexo-renderer-marked