🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Git Notes
Topic #29

GitHub Pages


Change Platform:


Enable GitHub Pages

GitHub Pages lets you publish a website directly from your repository. To enable it:

  1. Create a new repository named your-username.github.io.
  2. Add your website files (like index.html) to the repository.
  3. Push your changes to GitHub.

GitHub Create New Repository

GitHub Pages Naming Rules

Example

git remote add origin https://github.com/your-username/your-username.github.io.git
git push -u origin master

Set Source Branch/Folder

You can choose which branch and folder to publish. By default, GitHub uses main (or master) and the root folder. To change this:

  1. Go to your repository on GitHub.
  2. Click Settings > Pages.
  3. Under Source, select the branch and folder (e.g., main and docs).
  4. Click Save.

View Your Site

After enabling GitHub Pages, your site will be available at https://your-username.github.io/ (or your custom domain).

Navigate to Pages tab, and see your URL

Click the link to see your live site!


Disable GitHub Pages

To turn off your Pages site:

  1. Go to Settings > Pages.
  2. Click Delete or remove the source branch/folder.
  3. Optionally, delete the repository if you no longer need it.

Example

git push origin --delete gh-pages

Want to go beyond the notes?

Join CodingNow 2.0's Git course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

GitHub Pages – FAQs

Quick answers about learning GitHub Pages in Git.

This free note from CodingNow 2.0 explains GitHub Pages in Git — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Git topic on CodingNow 2.0, including GitHub Pages, is 100% free with no signup required.
With focused practice, most students grasp GitHub Pages in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now