Gitee is a very popular code hosting platform in China. It also provides very convenient static website hosting services. Many developers choose to use Gitee to deploy their websites. However, sometimes there is a problem that the Gitee deployment website is ineffective, resulting in only a 404 error page when accessing the website in the browser. What causes this? How should we solve it? The following provides solutions for everyone.
1. Confirm whether the submitted code is correctly uploaded to Gitee
First, we need to confirm whether all relevant files are uploaded correctly after submitting the code to Gitee. For example, HTML files, CSS files, JS files, etc. need to be ensured to be uploaded correctly.
If you are using the Git command line to submit, you can use the git status command to check the status of the submission. If there is a file that has not been submitted, use git add [file name] to add it, then use git commit to submit it to the local warehouse, "git push -u origin master" to push the code to the Gitee remote warehouse.
二, Confirm whether the Gitee Pages service has been turned on
In addition to confirming whether the code is uploaded correctly, we also need to confirm whether the Gitee Pages service has been turned on. If it is not turned on, your website will not display properly.
Open the Gitee website, enter your warehouse, click "Settings"-"Pages", and confirm whether the "Gitee Pages Service" has been turned on. If it is not turned on, you need to turn it on manually.
3. Make sure the correct branch is used
Under the premise that the Gitee Pages service is turned on, we also need to confirm whether the correct branch is used, that is, the "gh-pages" branch or the " master" branch.
When deploying the website, Gitee Pages will only recognize the code of these two branches. Therefore, if your website is deployed with other branches, it will not display properly. So please confirm whether the branch you are using is "gh-pages" or "master".
4. Confirm whether the correct custom domain name is set
If you use a custom domain name to bind the Gitee Pages service, you also need to confirm whether the correct custom domain name is set.
Open the Gitee website, enter your warehouse, click "Settings"-"Pages", and confirm whether the "custom domain name" is set correctly. If it is not set, or if it is set incorrectly, it will cause a 404 error when accessing the website.
5. Confirm whether the DNS resolution is effective
The last reason that may cause the Gitee deployment website to be ineffective is that the DNS resolution does not take effect. If you do not configure DNS resolution correctly after setting a custom domain name, you will not be able to access the website normally.
After confirming that the custom domain name is set correctly, you can use the online tool Traceroute to check whether the DNS resolution is successful. If it fails, you need to enter your domain name management interface and manually configure DNS resolution.
Summary:
Through the above five aspects of troubleshooting, you should be able to solve most of the problems of invalid Gitee deployment websites. Of course, if the above troubleshooting methods cannot solve the problem, then you need to further understand the specific situation. The problem may occur elsewhere. I hope this article can help you, and I wish you a smooth launch of your website!
The above is the detailed content of How to solve the problem of ineffective Gitee deployment website?. For more information, please follow other related articles on the PHP Chinese website!