GitHub can be used as a web hosting service to host static websites. Here are the general steps to use GitHub as web hosting:
-
Create a new repository: Create a new repository on GitHub with the name in the format .github.io, where is your GitHub username.
-
Clone the repository: Clone the repository to your local machine using the git clone command and navigate to the local repository directory.
-
Create a new index file: Create a new index.html file in the root directory of the repository. This file will be the homepage of your website.
-
Commit and push: Add the index.html file to the repository, commit the changes, and push the changes to GitHub using the git add, git commit, and git push commands.
-
Enable GitHub Pages: Go to the repository settings page on GitHub and enable GitHub Pages by selecting the branch and directory that contains your website files.
-
Verify: Wait for a few minutes for the website to be published, and then verify that your website is live by visiting .github.io in a web browser.
-
You can now add more pages to your website by adding HTML, CSS, and JavaScript files to the repository and committing them to GitHub. GitHub Pages also supports custom domain names, HTTPS, and Jekyll for building and deploying websites.
Note that GitHub Pages only supports static websites, which means that server-side languages like PHP or databases cannot be used.
Please create an Issue for any improvements, suggestions or errors in the content.
You can also contact me using Linkedin for any other queries or feedback.