Git & GitHub
/Beginner
GitHub Pages
Definition
A free static site hosting service offered directly by GitHub. It takes HTML, CSS, and JavaScript files straight from a repository and publishes a website.
Explain Like I'm New
Free web hosting. You push your `index.html` and `styles.css` files to a GitHub repository, go to the repository Settings, turn on GitHub Pages, and within 30 seconds, your website is live on the internet at `your-username.github.io/project-name`.
Real World Example
Hosting your personal portfolio website entirely for free without needing to buy a server or set up AWS.
Common Use Cases
- •Hosting static websites
- •Hosting documentation
- •Personal portfolios
Terminal Output
bash / terminal
/*
How to deploy a basic site to GitHub Pages:
1. Create an 'index.html' file locally.
2. Push it to the 'main' branch on GitHub.
3. On GitHub, click 'Settings' -> 'Pages' (on the left sidebar).
4. Under 'Build and deployment', set Source to 'Deploy from a branch'.
5. Select the 'main' branch and click Save.
6. Wait 1 minute. Your site is live!
*/
Interview Questions
basic
- Can GitHub pages host a Node.js or Python backend server?
intermediate
- Which branch does GitHub Pages usually look at to publish your site?