GitHub provides free hosting service for static website
which is called GitHub pages.
Let’s start by creating a new repository on your GitHub
account and then clone it to the directory you want to clone it in using the terminal
by typing “git clone ‘the link you’ve copied’”. Move into your project using “cd
name of your project” then open it in visual studio by typing “code. “.
Now in visual studio create a file named index.html and
write your code there. Next, we have to push this code into GitHub by typing in
Visual Studios’ terminal:
1-
“Git status”: to know if we’re
in the main branch because when GitHub pages ran it will look to the main branch and its code by default
2-
“Git add .” : to add all
the changes
3-
“Git commit -m initialcommit”:
to commit the changes
4-
“Git push origin main”:
this will push the code to GitHub repository
Now after we have pushed the project to GitHub repository,
the last step is to get the website hosted by GitHub pages. In GitHub go to settings
of my repository, then to GitHub pages and choose the source branch main and
save it. Refresh the page, you will find your site ready to be published, click
on it and congrats your website is ready.
WMK Tech Copyright © 2024. All rights reserved