blog posts

How To Host A Website For Free Using Github Pages?

You can host a small web application or a simple website for free. Of course, it takes a little more effort, but it’s worth the money. GitHub pages are one of these options.

You can host a small web application or a simple website for free. Of course, it takes a little more effort, but it’s worth the money. GitHub pages are one of these options. 

 

What are GitHub Pages? 

GitHub Pages is a service created by GitHub that allows you to build a website or web application by storing it in a free GitHub repository. You can host a complete website with different pages. The website code is stored in the GitHub repository and GitHub publishes it so that it can be accessed on any laptop or computer. 

 

Githab base 

GatHub is a popular version control service for computer programmers that uses Git to store and control code. The code is stored in repositories, which are containers on the cloud server that allow you to access the code from all of your computers. 

You can create new repositories after using the GatHub website or using the command line after installing the gateway. Repositories can be named, public or private, and store code in any language. Once you have created your repository with the gateway, you can extract your code from the server, make changes to it, and then upload it back to the gateway. 

 

Set up a website on GitHub pages 

The process of hosting a website using GitHub pages is divided into three steps: 

1- Creating a gateway account 

2- Building a new tank 

3- Edit code and upload on GitHub 

 

Creating a gateway account 

You must have the gate installed and registered. Then choose a username and register using your email address and password. Then go to the home page. 

 

Construction of Githab reservoir 

You can see the “repositories” section on the GitHub home page. This section lists all of your repositories, as well as a “New” button that allows you to create a new repository. Click “New” to go to a new page. You must first enter the name of your repository: 

[USERNAME] .github.io

For example, if your username is Jake, your repository name will be Jake.github.io. After the username you can also add a description to your repository. Then select the “public” or “private” option. Public means that others can make corrections to the site, but private means that only you can make corrections. Finally, you can create a README file for your repository that is responsible for archiving projects. Then select “Create repository” to finish the job. 

 

Edit and upload a website 

Now go to the command line terminal and run the following command. Remember that [USERNAME] must be with your username: 

git clone https://github.com/[USERNAME]/ eatusername

Gate’s “clone” feature makes a copy of the repository on your computer so you can edit your code. Any changes you make to this code will be saved on the main repository. Now that the repository is in a saved folder, enter the folder using the terminal or click on the folder. Create an index.html file in the folder. 

Open the HTML file in your text editor and line

Enter by typing “Hello”. This is a line for displaying text. Then go to the folder containing the code. Now you can enter the changes in the repository by executing this gate code:

git add --all
git commit -m "Save changes"
git push -u origin master

If you have never shot one you owe it to yourself to give it a try. git add –all adds all changes. git commit prepares the changes and git push finalizes the changes. 

 

View the GitHub pages website 

Open your browser and go to https: // [USERNAME] .github.io. Here you can see your website. This site will run on any browser and any device.