Want to get a static site up quick without paying for hosting? GitHub Pages allows you to host directly from your GitHub repository. First thing you should do, if you haven’t already, is go and create an account with GitHub also I recommend downloading the GitHub desktop app.
Note: You only get one site per GitHub account, this sets up a unique domain for you page.
- To start you need to create a new repository named username.github.io, where username is your username on GitHub.
- Navigate into your new repository and click the Set up in Desktop button. Your Github Desktop app will open and you can save the repository to your computer.
- Now we create an index.html file in the repository similar to one we made in HTML Basics. I have also put a html snippet below for you to copy into your index.html.
- Commit the index.html and publish your file/s to your repository.
- You should be set! Navigate to https://username.github.io to see your new site.
<!DOCTYPE html> <html> <body> <h1>Hello World!</h1> <p>This is [your-name] web page! I am hosting with GitHub Pages.</p> </body> </html>