DEV Community

Cover image for Host static website for free in less than 10 minutes.
vedant-jain03
vedant-jain03

Posted on

Host static website for free in less than 10 minutes.

What is github?

GitHub, Inc. is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management functionality of Git, plus its own features.

What is git?

Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

Prerequisite.

  • Github Account.
  • Git installed and configured with your github account.

Getting started

My folder structure

Image description

Create repository in github.

  • Create a new repository.

Image description

  • Configure repository details.

Make repository name shorter that will result to short URL.

Image description

The repository has to be public unless you are a pro member in github. I have access to create private repository as I have pro member tag on my github profile.

  • Commit the files

Start git bash and add these lines of code one by one.

  • git init
  • git add .
  • git commit -m 'my first commit'
  • git remote add origin https://github.com/{username}/{repository name}.git
  • git push -u origin master
  • Refresh the github repository page and you will see all files.

  • Configure github pages.

  • Go to settings.

Image description

  • Go to pages.

Image description

  • Select branch and save it.

Image description

Image description

You will get redirected

  • Your work is done

Refresh the page and you will see the deployed link.

Image description

Top comments (8)

Collapse
 
pandademic profile image
Pandademic

The repo has to be public unless you are a pro member , you might as well mention that.

Collapse
 
vedantjain03 profile image
vedant-jain03

Thankyou @pandademic

Collapse
 
webdev03 profile image
webdev03

I can create private repositories on my account and I do not have a pro membership though.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Yes but you can't enable github pages on them

Collapse
 
sso profile image
Sall

Nice post. I recently started to combine Cloudflare pages and GitHub pages which add many extra functionalities, still all automated and easy to deploy.

Example z-shell.pages.dev/docs/code

Collapse
 
vedantjain03 profile image
vedant-jain03

Glad it helps.

Collapse
 
eddocode profile image
Eddocode

Thank you for the tutorial, I hope to make some quick static pages right now

Collapse
 
vedantjain03 profile image
vedant-jain03

Glad it helps.