DEV Community

Cover image for How to publish webpages with github
Damilola Owolabi
Damilola Owolabi

Posted on

How to publish webpages with github

There are several ways through which you can deploy your website, Github is one of the easiest and fastest way to deploy your website developed with HTML, CSS and JavaScript. Apart from the fact that Github stores and allows you to share your code with multiple people, it also offers web hosting for your static HTML website.

It is a great tool which helps to showcase your project live to the whole world, isn’t that amazing! You tend to create awareness about your skills and services by sharing the link on various social media channels, It also open up opportunities that you can ever imagine. So, let’s get started I believe you already have an HTML page on ground.

STEP 1: Create an account on Github
Signup for a free account on Github: https://github.com/ Or if you’ve already have an account, login here https://github.com/login

STEP 2: Create a new repository
After you’ve successfully login on github, it automatically redirects you to the dashboard. There you will see a green button named “New”. Click on it to create a new repository, Thereafter;
• Input a repository name, the repository name can be anything. Just take note that the URL of your webpage will depend on what you name the repository, for example;
let’s assume your username is dammyton and your repository name is dammyton.github.io then automatically your URL will be dammyton.github.io
• Input the project description (tho it is optional)
• Lastly click on “Create repository”

STEP 3: Upload your files
You can decide to upload it manually on github by clicking on the upload files or you can as well upload your files via the terminal. Open the terminal program on your computer and navigate to the folder where your files are (the files you intend to upload). Then follow this subsequent steps;

    • git init
    • git add .
    • git commit -m “first commit”
    • git remote add origin https://github.com/your-username/repository name.git
    • git push -u origin master
Enter fullscreen mode Exit fullscreen mode

If you go back to the repository you created earlier you should see your files there.

STEP 4: Publish the webpages
Click the settings tab in your repository. Scroll down the settings page, you’ll find a section for github pages. Where source is set to none, change it to master branch then save. It will automatically display the URL. Yes, your webpage is now live. Congratulations!

Oldest comments (0)