Reputation: 11
I am attempting to deploy my blog on GitHub Pages using Hexo, but I am encountering a 404 error. I have tried numerous solutions but to no avail. Here are the details:
Node.js version: 9.7.2 Hexo version: 6.3.0 I can generate the page on my localhost (the hexo server command works as expected). I have correctly named my repository and set the deploy configuration in _config.yml as follows:
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: https://github.com/shioubi0216/shioubi0216.github.io.git
branch: main
I have ensured that the local repository is synchronized with the remote repository.
I have tried resetting the repository (deleting and recreating the GitHub Pages repository), but it didn't help.
I have installed the hexo-deployer-git package using
npm install hexo-deployer-git --save
multiple times.
I encountered a build failure with Jekyll at one point, and I set skip_render: true
, but the website is still not working.
I have checked the GitHub Pages troubleshooting guide for 404 errors, and the status seems fine.
I don't believe I am using DNS, but here is the URL configuration in _config.yml:
# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://shioubi0216.github.io/
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
I have cleared my browser cache and restarted my PC multiple times.
I noticed that I don't have an index.html
file. I had one in my Hexo directory earlier, but even with it, I couldn't deploy the site. I am unsure if this is related to the problem.
I have verified that the repository on GitHub is on the main branch.
Despite numerous attempts, I am unable to resolve this issue. I am turning to the Stack Overflow community for help. I am quite exhausted and considering resetting my PC if I can't find a solution soon. Any assistance would be greatly appreciated.
Upvotes: 0
Views: 570
Reputation: 1
There's two methods of connection that used by GitHub.
_config.yaml
is same as you configured on your own PC!For example, if you configured your Git as SSH, you must use the SSH Link of the Github repository to make it work, but not HTTP/HTTPS.
There's also a good choice is to deploy your website by Github Actions. You will get rid of saving and transferring the source files of your Hexo website.
Also, the most significant advantage of Github Actions is that once you push your commit to Github, the deployment will be done automatically.
Upvotes: 0
Reputation: 95
The answer of Jheng Syu is great. It works for me. I added my the deploy section of _config.yaml configuration in case anyone want to known the details.
deploy:
type: git
repo:
github:
url: '[email protected]:yaohuiwu/yaohuiwu.github.io.git'
branch: master
Upvotes: 0
Reputation: 11
I set the repo:
part of _config.yml
to the original github Https link to SSH link, and it work!
I have no idea why it work. but I success HAHAHA.
Upvotes: 1