-->

Deploy simple html on github pages free

So you wish to launch an easy website, however, don’t wish to own to travel through the uninteresting method of putting in yet one more hosting package. There is a neater solution. If you just wish to launch an easy static web site} you'll use GitHub Pages to host your site at no cost.

Let’s get started.

Note: This post assumes that you have a so-and-soHub account and a few basic knowledge of the version system Git.

Create Your GitHub Repository

The files that make up your web site can ought to be keep among a GitHub repository. If you’re creating a web site to market one among your existing GitHub comes you'll add the web site files to a brand new branch, otherwise you can simply setup a brand new repo for your website.

Note: If you are not adding your web site files to AN existing repo certify that you just setup a brand new repo before continued.

Now open up the terminal (command prompt on Windows) and build certain that you just have a duplicate of your GitHub repo on your PC. Once you got your local copy, move into the project folder using the cd command.

// Retrieve a copy of your GitHub repo.  
git clone https://github.com/user/repository.git
// Move into that directory.
cd repository
Note: Make certain that you just modification the clone uniform resource locator to the uniform resource locator of your GitHub repo. This can be found on the most project page.

Creating AN Orphan Branch

Now you want to form a brand new orphan branch among your repo that may hold all of your web site files.

This new branch should be called gh-pages.

git checkout --orphan gh-pages
If you already had files in the master branch of your GitHub repo you now need to delete these from the new gh-pages branch. To do this you can use the following command:

git rm -rf .
Adding Your Website Files

Now that your repo has been properly setup it’s time to add all of the HTML, CSS and JavaScript files that make up your website. Once you have added these to your repo you need to commit the changes. To do this you can use the following command.

git commit -a -m "Adding pages"
Note: The -a flag is a shorthand for git add .

Pushing Your Changes to GitHub

Okay so you’ve got all your files where they need to be. The only thing left to do now is to push the new gh-pages branch up to GitHub. You do this using the git push command.

git push origin gh-pages
That’s it! Your website should now be available at http://username.github.io/repository/.
Check out the video:



You may like these posts

  1. To insert a code use <i rel="pre">code_here</i>
  2. To insert a quote use <b rel="quote">your_qoute</b>
  3. To insert a picture use <i rel="image">url_image_here</i>