Thumbnail article
Github Pages is a static web hosting service provided by Github. This service is free and we can use a sub domain To deploy a static website into Github pages you should have a Github account and already install the Git. Follow the step below to deploy the static website. 1. Create a New Repository Create a new repository with the name Use your github username.Create a new repository2. Preparing Static Website We need to create a directory and create a file inside it named index.html. We can do this by opening the terminal or cmd and run the command below.
mkdir github-page
cd github-page
echo "Hello World" >> index.html
mkdir command will create a new folder named github-page. cd will change the current directory to github-page. the 3rd line is used to created an index.html that filled by text Hello World. You can also use your own static website if you already have one. Just make sure there is an index.html file inside your folder. 3. Push the Static Website to Github You need to push the file that you have been created to the github repository. Run the command below to push the file. Customize the url with your repository URL.
git init
git add index.html
git commit -m "first commit"
git remote add origin
git push -u origin master
4. Access the Static Website You can access the website using url. For our static website we can access it using url.  If the website still does not show up you can refresh the page.  It take a few seconds for github to prepare your static website. Advantages of Using GitHub Pages
  • No Server Setup Required. We don’t need to setup a server because GitHub itself will host our GitHub Page.
  • Limitations and Security. GitHub Page only allows/restricts us to use some tools, for example Jekyll and Hugo. With this we do not have to worry about security.
  • Quick Deployment. We just need to create a repository with the name <username> then type the HTML code or Markdown on the laptop then push it to the repository.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *