P粉2826276132023-08-16 11:05:40
To resolve an issue where a website hosted on GitHub Pages only displays the README page, follow these steps:
Verify branches: Make sure the branches you want to display on GitHub Pages are set up correctly. By default, GitHub Pages deploys content from the gh-pages
branch or the master
branch in the repository. If you want to use a different branch, you need to specify this in the repository settings.
Check directory structure: Make sure your website files are in the correct directory. In most cases, you will need to place HTML, CSS, and other resources in the root folder of the repository.
Confirm the index file: GitHub Pages looks for the index.html
file by default. Make sure your homepage file is named index.html
. If named differently, the files can be specified in the repository settings.
Update repository settings: Go to your repository's Settings tab and scroll down to the GitHub Pages section. Make sure you choose the correct source. You can select a branch or root folder to use for hosting.
If it is a React.js
application, please use the Github operation of React.js. Other frameworks such as Angular, Gatsby, and Next.js are similar. You can't use simple operations with applications from frameworks like React.js.
Verify DNS settings (if applicable): If you are using a custom domain name, check the DNS settings to ensure they are configured correctly
P粉7369355872023-08-16 09:13:37
This is expected behavior, according to the GitHub Pages documentation :
You need to provide an index.html
or index.md
file in the top-level directory (not inside the directory!), or put your content into README.md
middle.