Web Dev
Step by step guide for hosting static site in GitHub GitHub allows us to host static sites in GitHub for free. It also supports static site builders like ` Jekyll``. But let’s limit this article to hosting a plain static site.
Simple steps for hosting static sites. Create a GitHub account if you already don’t have one here". Advance user can use git & terminal to sync and push it to github
Download either GitHub for Mac or GitHub for Windows, depending on your operating system. Open the app and log in using the account you just created. For the advanced user, you can use a terminal and ssh to clone the repository]. For Mac: After you log in, click advanced and make sure that your name and email are correct. Then, click “Install Command Line Tools”, just in case you want to start using the command line later in life. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the “Push to GitHub?” box is checked. Move your website’s files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called “index.html”, and it must exist in the top-level directory. Back in the GitHub application, you should see your files in the left column. Make sure they are all checked. If so, enter a message in the text box called “commit summary”, something like “initial commit.” Then, click the commit button. Click the “Publish repo” button in the top right corner. Give it about 10 minutes, then check your-username.github.io. Your website should be there! Using a custom domain name You can just leave your website at that address (it’ll give you some serious street cred in the developer world), but if you have a custom domain you would like to use, it is very simple to make GitHub redirect your page.
Sep 15, 2022
3 min read