Are you a beginner in website developing ? Do you want to host a website for testing purpose for free? You have come to the right place.
- Basic knowledge of git.
- Basic knowledge of HTML , CSS,
- Code editor
- Command line
Okay now ! Go through the following steps to lunch your testing website with github.com as host for your site.
- First, open an account in github.com.
- Now, Click on the click new repository tab. Then, name your repository as “your-github-username.github.io” & click on create repository page. (Remember to replace your actual github username in above your-github-username. Also, don’t initialize the Readme file )
- Now , Go make a folder in your computer desktop to keep your website files. Make a file index.html inside that folder & put something about yourself. (Or whatever the heck you like)
- Now open up your command line . (I recommend git bash but you can use any command line available in your OS)
- Navigate to the folder you created above in your desktop.
- Type ” git init” //To initialize git in that folder
- Enter ” git add . ” //It adds all your files on your folder in git staging area. In our case index.html
- Enter “git commit -m “My first commit ” ” //To save your files in your staging area.
- Now , Enter “git remote add origin https://github.com/your-github-username/your-github-username.github.io.git” //To add your local git files to remote server. (This is done only for 1st time)
- Now , Enter “git push -u origin master” //To push your all files in your github repository.
- Now your website is published and can be access through “your-github-username.github.io” .
- Right now there is only index.html file in your repository. So you can only access that page. But you can always add new files & make changes to your website through command line or github website.
Hope this tutorial helps you to publish your free website using Github as host. Remember one thing, always put your files or info in github public repository which you want to share publicly otherwise your sensitive info can be misused as your public repo on github can be accessed by anyone.
Cheers ! Happy Coding !