Hosting your portfolio in React JS
Course: React JS Training
Topic: Hosting your portfolio
Course Link: React JS Training
Demo Link: Register for a Course Demo
1. Why hosting your portfolio matters
By this stage of the course you can build pages with HTML, style them with CSS and add behaviour with JavaScript. All of that work, however, sits in folders on your own computer. If a recruiter, an interviewer or a fellow developer asks to see what you can do, screenshots and zip files make a weak impression. A live web address that opens your portfolio in any browser, on any device, speaks for itself.
Hosting also closes the loop on everything you learnt in the earlier Git and GitHub pages. You created repositories, made commits, pushed branches and imagined how teams collaborate. Publishing is the moment those habits produce something visible: your repository stops being a private backup and becomes a public website that anyone can open with a link.
- A live link proves your projects actually run, not just that the files exist.
- An interviewer can open your work in seconds, on their own machine, with no setup.
- Every project you publish is one more repetition of the Git workflow you will use daily as a developer.
- Updating the site becomes routine, so your portfolio grows alongside your skills.
For a React learner this habit matters even more. Later in the course, when you build React applications, you will publish them the same way: commit, push, deploy. Learning it now on a plain HTML page means that when React enters the picture, the only new part is the build step.
2. Hosting, deployment and GitHub Pages in simple words
What hosting actually is
Hosting means storing your website files on a computer that stays connected to the internet around the clock, called a server. When someone types your web address into a browser, the server sends them your HTML, CSS, JavaScript and image files, and their browser assembles those files into the page they see.
Deployment is the act of moving your finished files onto that server. Hosting is the permanent home; deploying is each trip you make to deliver new or updated files to it.
Static sites and why they suit a portfolio
A static site is a website made of plain files: HTML documents, CSS stylesheets, JavaScript files and images. Nothing is calculated on the server when a visitor arrives; everything runs in the visitor's browser. A portfolio built from the HTML, CSS and JavaScript you have learnt so far is exactly this kind of site.
GitHub Pages is a hosting service built directly into GitHub. It takes the files in one of your repositories and serves them as a website. You do not need a separate hosting account, a control panel or an FTP tool; the repository you already push to becomes the website. This makes it the natural first host for a developer whose work already lives on GitHub.
A helpful mental model: GitHub stores your files, and GitHub Pages shows your files. Same repository, two roles.
3. Key terms for hosting a portfolio
These words appear on every hosting screen and in every error message, so it is worth fixing their meanings before touching anything.
| Term | Plain meaning |
| Server | A computer that is always online and hands out website files when asked. |
| Hosting | Keeping your site files on such a server so visitors can open them. |
| Deployment | The act of copying your latest files to the server. |
| Static site | A site of plain files that run in the visitor's browser, with no server-side code. |
| Repository (repo) | The Git project folder that GitHub stores for you, with its full history. |
| Branch | An independent line of work inside a repository; main is the usual default. |
| Push | Sending your committed work from your machine up to GitHub. |
| GitHub Pages | GitHub's service that turns a repository into a browsable website. |
index.html | The file a server shows by default when someone opens your address. |
| Build | A step that converts source code, such as React components, into plain browser files. |
| Custom domain | Your own web address, such as yourname.dev, pointed at your hosted site. |
| 404 error | The server's reply when the requested page or file cannot be found. |
4. How GitHub Pages works behind the scenes
From repository to web address
When you enable Pages on a repository, GitHub watches one branch you choose, normally main. Every time that branch receives a push, GitHub takes the files at that moment and serves them from its servers. Your live site is therefore always a reflection of a particular commit, which is a neat demonstration of why meaningful commit messages matter.
The address follows a fixed pattern built from your GitHub username and the repository name:
https://your-username.github.io/your-repo-name/
So a user named ashaverma with a repository named portfolio gets the address https://ashaverma.github.io/portfolio/. There is one special case: if the repository itself is named ashaverma.github.io, its contents are served at the bare address https://ashaverma.github.io/. Many developers reserve such a repository for their main portfolio.
What Pages can and cannot serve
Pages serves static files. That has two practical consequences:
- Plain HTML, CSS, JavaScript and images work perfectly, so everything you have built in this module can go live as it is.
- Server-side languages and databases do not run on Pages. Any JavaScript you write, including code that calls public APIs with
fetch, still works fine because it runs in the visitor's browser.
When you later reach React projects, remember this rule: a React app is compiled by a build command into a folder of plain HTML, CSS and JavaScript files. You publish that generated folder, not the component source files. The publishing habit itself stays exactly what you practise on this page.
With a standard GitHub account, enable Pages on a public repository; that is the straightforward setup for a learning portfolio and it also lets reviewers read your code.
5. Folder structure a portfolio needs before hosting
Hosting goes smoothly when the repository is shaped like a website. The single most important rule: your home page must be a file named index.html sitting at the top level of the repository. When a visitor opens your address without typing a file name, the server looks for index.html and shows it. A repository whose home page is called home.html or page1.html will greet visitors with a 404 error.
A tidy multi-page portfolio looks like this:
portfolio/
index.html
about.html
css/
style.css
js/
script.js
images/
profile.jpg
project-weather.png
Follow these structural rules and most hosting problems simply never appear:
- Keep
index.html at the root of the repository, not inside an extra folder.
- Reference other files with relative paths, such as
css/style.css or images/profile.jpg, never with paths that start from your own disk like C:/Users/... or file:///.
- Match the capitalisation of file names exactly. GitHub's servers treat
About.html and about.html as different files, which silently breaks links on some systems that do not.
- Commit the whole project, including the
css, js and images folders; the published site is only as complete as what you pushed.
6. The Git commands that publish your work
Publishing uses no new Git commands at all. It is the same commit-and-push rhythm from the earlier pages, applied to your portfolio. Here is the full sequence with the role of each command:
| Command | What it does |
git init | Turns the current folder into a Git repository, if it is not one yet. |
git status | Shows which files changed and which are staged, so you always know what you are about to publish. |
git add . | Stages every change, marking it ready to be committed. |
git commit -m "message" | Records a snapshot of the staged changes with a short description. |
git branch -M main | Makes sure your main branch is named main, matching what GitHub expects. |
git remote add origin URL | Connects your local repository to the matching repository on GitHub. |
git push -u origin main | Uploads your commits to GitHub and remembers the link for future pushes. |
git pull | Downloads commits that exist on GitHub but not yet on your machine. |
After the first git push -u origin main, later updates need only three steps:
git add .
git commit -m "Describe what you changed"
git push
Each push to the branch that Pages watches is what triggers a fresh deployment. In other words, git push is not just backup; it is the publish button.
7. Turning on GitHub Pages step by step
Once your code is on GitHub, switching on the website takes about a minute. Work through these steps in order.
Prepare the repository
- On
github.com, create a new repository. Give it a clear name such as portfolio.
- Keep it public so the standard Pages setup works and people can view your source code.
- Push your project from your computer using the command sequence from the previous section.
- Open the repository page on GitHub and confirm that
index.html is visible at the top of the file list, not buried in a subfolder.
Enable Pages in the settings
- At the top of the repository page, open the Settings tab.
- In the left sidebar, choose Pages.
- Under the build and deployment source, pick Deploy from a branch.
- Select your branch, normally
main, and the folder option / (root).
- Click Save.
Confirm the site is live
- Return to the Pages screen after a short wait; when a message appears saying your site is published, open the shown address.
- Check that the page loads, the styles apply and the images appear.
- Save the address. It now works in any browser, on any device, and it will keep working as you push updates.
The very first deployment can take a few minutes. If the address shows a 404 immediately after saving, wait briefly and reload before hunting for a mistake.
8. Worked example: publishing a one-page portfolio
Start with the smallest possible case: one file, no folders. This example belongs to a learner named Asha, who has written a single self-contained page.
The file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Asha Verma | Web Developer</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 700px;
margin: 40px auto;
padding: 0 16px;
line-height: 1.6;
}
h1 { color: #2c3e50; }
</style>
</head>
<body>
<h1>Asha Verma</h1>
<p>Frontend developer learning React. I build clean, responsive web pages.</p>
<h2>Projects</h2>
<ul>
<li>Weather dashboard built with HTML, CSS and JavaScript</li>
<li>Quiz app using DOM events and localStorage</li>
</ul>
<p>Email: [email protected]</p>
</body>
</html>
Publishing it
Inside the folder that contains this index.html, Asha runs:
git init
git add .
git commit -m "Add first version of my portfolio page"
git branch -M main
git remote add origin https://github.com/ashaverma/portfolio.git
git push -u origin main
Then she enables Pages as described above: Settings, Pages, deploy from branch main, folder / (root), Save.
The result
Within a few minutes, https://ashaverma.github.io/portfolio/ opens her page from any browser. Visitors see the heading, the project list and the contact line, styled by the embedded CSS. Note that the styles worked even though they live inside the HTML file; Pages simply serves whatever files the repository contains, and the browser does the rest. Note also the repository name portfolio appearing in the address, exactly as the URL pattern predicts.
9. Worked example: publishing a portfolio with separate CSS and JavaScript
Real projects separate structure, style and behaviour into different files. Hosting handles this without any extra effort, as long as the relative paths are correct.
The project layout
portfolio/
index.html
about.html
css/
style.css
js/
script.js
images/
profile.jpg
The home page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Asha Verma | Web Developer</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<h1>Asha Verma</h1>
<p>Frontend developer learning React</p>
</header>
<main>
<section>
<h2>Projects</h2>
<ul id="project-list"></ul>
</section>
</main>
<script src="js/script.js"></script>
</body>
</html>
The stylesheet, css/style.css
body {
font-family: Georgia, serif;
max-width: 720px;
margin: 0 auto;
padding: 24px;
line-height: 1.6;
}
header {
border-bottom: 2px solid #2c3e50;
margin-bottom: 24px;
}
The script, js/script.js
const projects = [
{ name: "Weather dashboard", tech: "HTML, CSS, JavaScript" },
{ name: "Quiz app", tech: "DOM events and localStorage" },
{ name: "To-do list", tech: "Arrays and functions" }
];
const list = document.getElementById("project-list");
projects.forEach(function (project) {
const item = document.createElement("li");
item.textContent = project.name + " - built with " + project.tech;
list.appendChild(item);
});
Publishing and what happens
The commands are identical to the one-file example; Git does not care whether you are pushing one file or twenty:
git add .
git commit -m "Rebuild portfolio with separate CSS and JS files"
git push
Pages serves the whole folder tree, so css/style.css and js/script.js are fetched by the browser automatically when index.html asks for them. Because the paths in the HTML are relative and the folder structure is preserved by Git, everything links up on the live site exactly as it did on Asha's machine. The project list on the live page is generated at view time by the JavaScript running in each visitor's browser, which is precisely how a static site carries dynamic behaviour.
10. Worked example: updating your live site after a change
Suppose Asha adds a contact section to index.html on her laptop. Publishing the change is a three-command habit, and it is worth burning into memory because you will repeat it hundreds of times across your career.
git status
git add index.html
git commit -m "Add contact links to the portfolio"
git push
What happens next, in order:
git status confirms only index.html changed, so she stages exactly that file.
- The commit records the change with a message that says what it does.
- The push delivers the commit to GitHub.
- GitHub notices a new commit on
main, the branch Pages watches, and rebuilds the site from it.
- After a short delay, the live address shows the new section.
Two small habits prevent confusion here. First, if the live page still shows the old version a minute after pushing, it is usually the browser's cache: a hard refresh with Ctrl+F5 on Windows or Cmd+Shift+R on macOS fetches the fresh files. Second, do not skip the commit step and simply push; only committed work travels to GitHub, so an uncommitted edit will never appear on the live site no matter how many times you push.
11. Common hosting problems and how to fix them
Nearly every first-time hosting problem falls into one of a few categories. Diagnose with this table before changing anything at random.
| What you see | Likely cause | How to fix it |
| 404 at your Pages address right after enabling | Pages is still building, or the wrong branch or folder was chosen | Wait a few minutes and reload; check Settings, Pages shows branch main and folder / (root) |
| 404 for one particular page or image | File name capitalisation or spelling differs from the link | Match names exactly, commit the fix, push again |
| Page loads but looks unstyled | The <link> path does not match the real folder, such as style.css written while the file lives in css/ | Correct the relative path, commit, push |
| Old content still showing after a push | Browser cache, or the deployment is still running | Wait a minute, then hard refresh with Ctrl+F5 or Cmd+Shift+R |
| Completely blank white page | A JavaScript error, or index.html missing from the repository root | Open the browser console for error messages; confirm index.html sits at the top level and is pushed |
| Changes pushed but nothing appears ever | The edits were never committed, or you pushed a different branch than the one Pages watches | Run git status, commit pending work, and verify the Pages source branch |
Notice the pattern in the fixes: almost everything is solved by comparing what the repository actually contains on GitHub with what the HTML references. The live site is never a mystery; it is a faithful copy of a commit.
12. GitHub Pages compared with other hosting options
GitHub Pages is not the only way to put a portfolio online, and knowing the landscape helps you choose deliberately rather than by accident.
| Option | Best suited for | What to know |
| GitHub Pages | Static portfolios, HTML/CSS/JS projects, built React apps | Lives inside GitHub, no separate account; each push to the chosen branch republishes the site |
| Netlify or Vercel | Static sites and modern JavaScript applications | Connect your Git repository and the platform rebuilds and redeploys automatically on every push; free tiers comfortably cover a student portfolio |
| Traditional paid web hosting | Sites that need a server-side language such as PHP or a database | More setup and cost; generally more machinery than a portfolio needs |
| Just opening the file on your computer | Practice and local experiments only | Not hosting at all; nobody else can open it, and paths behave differently than on a real server |
For this course the practical advice is simple: publish your HTML, CSS and JavaScript work on GitHub Pages, because the hosting lives where the code already lives. As your React projects arrive, you can keep using Pages or move to a platform such as Netlify or Vercel; the Git workflow underneath is identical in every case, which is exactly why you are learning it now.
13. Making the repository itself portfolio-ready
Hosting makes your code visible, so the repository becomes part of your portfolio too. A visitor who opens the code view should immediately understand what they are looking at.
- Name repositories clearly:
portfolio, weather-dashboard and quiz-app read far better than test1 or final-final2.
- Add a README at the repository root explaining what the project is, which technologies it uses and the link to the live site.
- Keep one project per repository, so each piece of work has its own clean history and its own live address.
- Commit regularly with real messages, because the commit history is a public record of how you work.
A minimal but effective README for the portfolio repository:
# Asha Verma - Portfolio
My personal portfolio website, built with HTML, CSS and JavaScript.
Live site: https://your-username.github.io/portfolio/
## Structure
- index.html - home page
- about.html - short bio and skills
- css/ - stylesheets
- js/ - scripts
- images/ - photos and project screenshots
The address shown there is a placeholder pattern; replace it with your own username and repository name. Once the README is in place, the same live link belongs on your resume and your professional profiles, and it will be the first thing a reviewer opens. From here on, treat every finished project the same way: commit it, push it, publish it, then add the link.
14. Real-world workflow: branches, pull requests and a site that never breaks
Part 1 showed the simple path: commit to main, push, watch the site update. Real teams rarely push straight to main. They work on a feature branch, open a pull request, review the changes and only then merge. You can borrow exactly this discipline for your portfolio, and it rehearses the team workflow from the earlier pages with zero risk.
The rule that makes this powerful: whatever is on main is what the public sees. Experiments live on branches, and the live site only changes when a merge lands on main.
git checkout -b add-projects-section
# ... edit index.html, add a projects list ...
git status
git add .
git commit -m "Add projects section to the home page"
git push -u origin add-projects-section
- Open the repository on GitHub; a banner offers to open a pull request for the new branch. Accept it.
- Read the diff, the line-by-line list of changes, and check every file you touched.
- Merge the pull request into
main.
- Back on your computer, sync up and retire the finished branch:
git checkout main
git pull
git branch -d add-projects-section
GitHub Pages then republishes the site from the updated main. Because every change to the public site arrives as a reviewed, merged commit, your commit history becomes a readable story of how the portfolio grew, which is exactly what a reviewer wants to see.
15. Custom domains and fine-tuning your Pages site
Using your own web address
The default username.github.io/repo-name address is free and permanent, but a personal domain such as yourname.dev looks sharper on a resume. The setup has two halves:
- Buy the domain from a domain registrar; the name itself is separate from hosting.
- In your repository, open Settings, then Pages, and enter your domain in the custom domain field.
- GitHub displays the exact DNS records to create at the registrar. Follow the values shown there rather than memorising them, because the required records are published by GitHub and can change.
- Wait for the DNS changes to spread, then switch on Enforce HTTPS so visitors always reach the secure version.
Once the domain is accepted, GitHub may add a small file named CNAME to your repository containing your domain name. Leave it in place; deleting it unsets the domain on the next deployment.
Other settings worth knowing
- Deploy source: Pages can publish from the root of a branch, from a
/docs folder on a branch, or from a dedicated branch. The root of main is the simplest choice for a portfolio.
- A
404.html page: create a file with this exact name at the repository root and Pages will show it whenever a visitor opens an address that does not exist, turning dead links into a friendly message.
- Files beginning with an underscore: some build tools generate folders such as
_assets that Pages skips by default. Adding an empty file named .nojekyll to the repository root tells Pages to publish everything exactly as committed.
16. A glimpse ahead: hosting your future React projects
The portfolio you host today is plain files, but this course leads to React, so it helps to see now how the same publishing habit scales. A React application is not served as component source files. A build step compiles your components and styles into a folder of ordinary HTML, CSS and JavaScript that any browser can run. You host that output folder, exactly as you host today's files.
Three real-world approaches, all used by working developers:
- Run the build yourself: execute the project's build command, which produces the output folder, then publish that folder through Pages or any static host. Simple, and it shows you what a build really is.
- Automate it with GitHub Actions: GitHub's built-in automation can run steps for you on every push. A workflow file stored in a
.github/workflows/ folder describes the recipe: check out the code, install dependencies, run the build, publish the output folder to Pages. After that, git push does everything.
- Connect a platform such as Netlify or Vercel: these services watch your repository, build each push automatically and can give a temporary preview address for every branch, which is how teams review unfinished work online before merging.
Notice what stays constant in all three: the Git rhythm. Commit, push, publish. Whether the artefact is a hand-written HTML file or a compiled React bundle, deployment still means making main reflect reality.
17. Testing your site like a real visitor
Passing on your own machine is not the same as passing on the internet. After every deployment, spend a few minutes acting like a stranger who has never seen the project.
- Open the live address in a private or incognito window, so cached files cannot flatter you.
- Open the browser console in the developer tools and confirm there are no red errors and no failed requests shown as 404.
- Click every link and navigation item, especially links between your own pages.
- Resize the window or use the device toolbar to check the mobile layout, because many visitors will browse on a phone.
- Submit any forms with deliberately wrong input to confirm your validation still runs on the hosted copy.
Hosting also unlocks capabilities a local file:// page lacks. Pages serves your site over HTTPS, and several browser APIs only run on secure pages. When you reach the Fetch API and later React projects that call public APIs, a properly hosted HTTPS site behaves the way real applications do, which is one more reason to publish early instead of waiting until the end of the course.
18. Common mistakes and the correct way
Each row is a mistake beginners genuinely make on a first deployment, paired with the habit that prevents it.
| Mistake | Why it hurts | The correct way |
Saving the home page as home.html | Servers look for index.html by default, so visitors get a 404 | Name the entry file index.html at the repository root |
Paths written from your own computer, like C:/Users/asha/site/style.css | They point at your laptop, which no visitor has | Use relative paths that describe position inside the project |
A leading slash on asset paths, like /css/style.css | Your site lives under /repo-name/ on Pages, so the leading slash points to the wrong place | Drop the slash: css/style.css resolves relative to the current page |
Linking About.html when the file is about.html | Hosting servers treat case strictly; the link works locally but 404s live | Match case exactly; prefer all-lowercase file names |
| Editing on GitHub's web editor while uncommitted edits sit on your laptop | The two versions disagree, producing merge conflicts | Edit in one place, normally your machine, and run git pull before starting work |
| Committing dependency folders, huge videos or operating system junk | The repository becomes slow and unreadable for reviewers | Add a .gitignore listing generated and junk files before the first commit |
| Committing API keys or passwords to a public repository | Anyone can read the files, and history keeps old commits even after deletion | Keep secrets out of code entirely; if one leaks, revoke and replace it immediately |
| Pushing with unsaved editor tabs or skipping the commit step | Push uploads only commits, so unsaved or uncommitted work never deploys | Run git status before every push to confirm nothing is stranded |
<!-- Wrong: points at a private folder on your computer -->
<link rel="stylesheet" href="C:/Users/asha/portfolio/css/style.css">
<!-- Wrong: assumes the site sits at the top of a domain -->
<link rel="stylesheet" href="/css/style.css">
<!-- Correct: relative to the current page, works at any address -->
<link rel="stylesheet" href="css/style.css">
19. Best practices for hosting your portfolio
- Pull before you push. Starting work on an out-of-date copy is the most common source of conflicts; one
git pull avoids it.
- Commit small and often, with messages that say what changed and why, so the public history explains your project without you in the room.
- Run
git status before every git add, so you always publish exactly what you intend to publish.
- Keep
main always deployable. Risky ideas belong on branches; the live site should never be half-broken.
- Use lowercase, hyphenated file names such as
about-me.html; they avoid case bugs and read cleanly inside public web addresses.
- Verify after every deployment with the visitor checklist above, not just on your own machine.
- Never commit secrets such as API keys; treat a public repository like a noticeboard anyone can photograph.
- Keep the site alive. Push small improvements regularly, because a stale portfolio quietly signals stale skills.
20. Practical project: publish a three-page portfolio end to end
This project combines everything: a multi-page site, a clean repository, first deployment, and one update shipped through a branch and pull request.
Plan the structure
portfolio/
index.html
projects.html
contact.html
css/style.css
js/main.js
.gitignore
README.md
Create the pages
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Asha Verma | Home</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<nav>
<a href="index.html">Home</a>
<a href="projects.html">Projects</a>
<a href="contact.html">Contact</a>
</nav>
<main>
<h1>Asha Verma</h1>
<p>Frontend developer learning React. This portfolio is hosted on GitHub Pages.</p>
</main>
<p>© <span id="year"></span> Asha Verma</p>
<script src="js/main.js"></script>
</body>
</html>
Now create projects.html and contact.html with the same skeleton, changing only the <title> and the content of <main>:
<!-- projects.html -->
<main>
<h1>Projects</h1>
<ul>
<li>Weather dashboard - HTML, CSS, JavaScript, public API</li>
<li>Quiz app - DOM events and localStorage</li>
<li>To-do list - arrays and functions</li>
</ul>
</main>
<!-- contact.html -->
<main>
<h1>Contact</h1>
<p>Email: [email protected]</p>
<p>GitHub: github.com/ashaverma</p>
</main>
Add the stylesheet and the script
/* css/style.css */
body {
font-family: Arial, sans-serif;
max-width: 680px;
margin: 0 auto;
padding: 20px;
line-height: 1.6;
}
nav a {
margin-right: 16px;
text-decoration: none;
}
nav a.active {
font-weight: bold;
}
// js/main.js
const yearSpan = document.getElementById("year");
if (yearSpan) {
yearSpan.textContent = new Date().getFullYear();
}
// Highlight the current page in the navigation
const current = location.pathname.split("/").pop() || "index.html";
document.querySelectorAll("nav a").forEach(link => {
if (link.getAttribute("href") === current) {
link.classList.add("active");
}
});
Ignore junk, commit, connect and push
# .gitignore
.DS_Store
Thumbs.db
private-notes.txt
git init
git add .
git commit -m "Build three-page portfolio with shared navigation"
git branch -M main
git remote add origin https://github.com/ashaverma/portfolio.git
git push -u origin main
Then enable Pages as shown in the earlier step-by-step section: Settings, Pages, deploy from branch main, folder / (root), Save.
Verify, then ship an update through a branch
Open the live address in an incognito window, check the console for errors, click through all three pages and test the mobile layout. When everything passes, add a small improvement the professional way:
git checkout -b add-contact-note
# edit contact.html, add one more line
git add contact.html
git commit -m "Mention response time on the contact page"
git push -u origin add-contact-note
Open the pull request on GitHub, review the diff, merge it, then sync your machine:
git checkout main
git pull
git branch -d add-contact-note
Finish with a README
# Portfolio - Asha Verma
Three-page personal portfolio built with HTML, CSS and JavaScript.
**Live site:** https://ashaverma.github.io/portfolio/
Replace the address with your own username and repository name. The moment this README is pushed, the live link travels with the code, and you can paste it into your resume and professional profiles.
21. Practice Exercises
- Publish a single
index.html page, then rename the file to something else, push and observe the 404. Restore the name and confirm the site returns.
- Add a
404.html file with a friendly message and a link home, then visit a made-up address on your live site to see it appear.
- Case-sensitivity experiment: link to
Images/Photo.jpg while the real file is images/photo.jpg, compare behaviour on your computer and on the live site, then fix it.
- Ship one genuine change using the full professional loop: feature branch, commit, push, pull request, merge, delete branch, verify the redeploy.
- Write a
.gitignore for a project with temporary notes and system junk files, and use git status to prove the ignored files never enter a commit.
- Mobile audit: open your live site in the device toolbar, list three layout problems, fix them, redeploy and re-check.
- Upgrade an existing repository's README with the live site address, the technology list and a short structure overview.
22. Interview Questions and Answers
What is GitHub Pages?
A static hosting service built into GitHub. It serves the files of a chosen branch of a public repository as a website at an address like username.github.io/repo-name, and republishes automatically whenever that branch receives a push.
What is the difference between hosting and deployment?
Hosting is the ongoing service of keeping your files on an always-online server so people can open them. Deployment is the act of delivering a particular set of files to that server. With Pages, hosting is continuous and every push to the source branch is a new deployment.
How does a git push turn into an updated website?
The push uploads your commits to GitHub. Pages watches the configured branch, notices the new commit and copies the files at that commit to its serving infrastructure. Moments later, visitors receive the new version.
Why must the entry file be named index.html?
Web servers serve a default document when a visitor requests a folder without naming a file, and the convention on Pages is index.html at the repository root. Any other name means the visitor sees a 404 instead of your page.
What is a static site, and why does it suit a portfolio?
A static site is fixed files that the browser assembles and runs, with no server-side computation per request. A portfolio of HTML, CSS and JavaScript is exactly that, so static hosting such as Pages serves it perfectly and cheaply.
Why do absolute paths break a site after hosting?
Paths like /css/style.css assume your site sits at the top of a domain, but a Pages project lives under /repo-name/. Relative paths such as css/style.css are resolved against the current page address, so they work wherever the site is mounted.
How would you publish a React application?
Run the project's build command, which compiles the components into a folder of plain HTML, CSS and JavaScript, then host that output folder on Pages or a platform such as Netlify or Vercel. Teams often automate the build with GitHub Actions so every push publishes itself.
Your live site still shows the old version after a push. What do you check?
First, whether the deployment has finished; Pages takes a short time to rebuild. Second, whether the push actually contained the change, using git status and the commit list on GitHub. Third, whether Pages is watching the branch you pushed to. Finally, do a hard refresh, because your browser may be showing cached files.
How do you roll back a bad change on a live site?
Create a new commit that undoes the bad one with git revert, then push. Because the site always mirrors the latest commit on the watched branch, the revert itself becomes the next deployment and restores the previous behaviour without rewriting history.
What is a custom domain and a CNAME record?
A custom domain is a web address you own, pointed at your hosted site. A CNAME is a DNS record that maps a name such as www to another name such as your-username.github.io. GitHub also records the domain in a CNAME file inside the repository so deployments keep it.
Why should secrets never be committed to a public repository?
Anyone can read the files, and Git history preserves them even after deletion. Frontend code reaches visitors' browsers anyway, so anything inside it is effectively public. Keep credentials out of the repository and out of the code, and rotate any key that has been exposed.
What is .gitignore and why does it matter before publishing?
It is a file listing patterns Git should never track, such as operating system junk, dependency folders or build output. It keeps the repository small and readable, and ensures only intentional files reach the public site.
23. Quick Revision Checklist
- Hosting stores your site on an always-online server; deployment delivers files to it.
- GitHub Pages serves a public repository branch at
username.github.io/repo-name.
index.html at the repository root is the entry file; 404.html customises missing pages.
- Use relative paths, exact file name case, and no leading slash on assets.
- Update rhythm:
git status, git add ., git commit -m "..."}| wait, that is wrong: git commit -m "...", git push.
- First setup:
git init, git branch -M main, git remote add origin, git push -u origin main.
- Enable Pages under Settings, Pages, deploy from branch, root folder.
main is the live site; experiments travel through branches and pull requests.
- Stale site? Check deploy finished, correct branch, actual commit contents, then hard refresh.
.nojekyll publishes underscore files; the CNAME file holds a custom domain.
- React projects are built first; publish the output folder, possibly automated with GitHub Actions.
- Never commit secrets or junk; keep a README with the live link.
24. Official Documentation and Further Reading
Our course research did not confirm direct addresses for Git or GitHub documentation, so no links of that kind are cited here. The readings below come from the course's verified link list and connect hosting to the React work waiting after this module:
Conclusion
Hosting is the step that turns Git from a private notebook into a public showcase. You now own the complete loop every frontend developer repeats for years: build, commit, push, publish, verify. Your repository tells the story of how you work, your live address proves the work runs, and neither depends on anyone's permission or setup.
Carry one rule forward from this page: a project is not finished until it has a live link. From your plain HTML portfolio to the React applications later in this course, the same habit applies, and every time you practise it, deployment stops being an event and becomes what it should be, a normal part of writing code.
Learn more in the React JS Training course, or register for a course demo.