Table of Contents
What You Will Learn?
By the end of this guide, you will clearly understand how to:- Upload your project code to GitHub.
- Connect your local project with an online repository.
- Deploy your project for free using hosting platforms.
- Get a working live URL that you can share with others.
Prerequisites
Before beginning, make sure you have the following ready:- A project folder that contains your files (for example: HTML, CSS, JavaScript, or React files).
- A GitHub account created on GitHub.
- Basic familiarity with opening Command Prompt (CMD).
Step 1: Install Git
Git is a tool that allows your computer to communicate with GitHub. Without Git, you cannot upload your project.1. Go to the official website of Git.
2. Download and install Git for your system.
3. After installation, open Command Prompt (CMD).
Now type:
If you see a version number (for example: git version 2.x.x), it confirms that Git is installed correctly and ready to use.git --version
Step 2: Initialize Your Project Folder
Now you will prepare your project so Git can track it.1. Open your project folder.
2. Right-click inside the folder and open Command Prompt.
3. Run this command:
This command creates a hidden .git folder. It tells your system that this project will now be tracked using Git.git init
Step 3: Add and Save Your Project Files
Now you will tell Git to include your files and save a snapshot.1. Run these commands:
Explanation:git add .
git commit -m "Initial commit"
- git add .: tells Git to include all files in your project.
- git commit: saves the current version of your project with a message. Think of this like saving your work with a label.
Step 4: Create a Repository on GitHub
Now you will create an online space where your project will be stored.1. Open GitHub.
2. Click on New Repository.
3. Enter a name for your project (for example: my-website).
4. Click Create Repository.
GitHub creates a remote storage location for your project. This is where your code will be uploaded.
Step 5: Connect Your Project to GitHub
Now you will link your local project to the GitHub repository.1. Copy the repository URL and run:
Explanation:git remote add origin https://github.com/your-username/your-repo-name.git
git branch -M main
git push -u origin main
- git remote: add origin connects your project to GitHub.
- git push: uploads your code to GitHub.
Step 6: Deploy Using GitHub Pages (For Simple Websites)
If you have created your project using HTML, CSS, and JavaScript, this method is the simplest.1. Open your repository on GitHub.
2. Go to Settings → Pages.
3. Under “Branch”, select:
4. Click Save.Branch: main
Folder: /root
5. GitHub will automatically create a live website for your project.
6. You will get a link like:
Anyone with this link can now open your website in a browser.https://your-username.github.io/repo-name/
Step 7: Deploy Using Free Hosting Platforms (For Advanced Projects)
If your project uses frameworks like React or includes backend code, you should use hosting platforms.Option 1:
Netlify
This is one of the easiest platforms for beginners.
- Go to Netlify.
- Click on Add New Site → Import from Git.
- Connect your GitHub account.
- Select your repository.
- Click Deploy.
Option 2:
Vercel
This platform is excellent for React and Next.js projects.
- Go to Vercel.
- Log in using GitHub.
- Import your project repository.
- Click Deploy.
Option 3:
Render
This platform is useful if your project includes backend APIs.
- Go to Render.
- Connect your GitHub account.
- Select your repository.
- Deploy your service.
Common Mistakes Beginners Make
- Nothing updates: Forget to run git commit before pushing code.
- git push fails: Copied the wrong repository URL.
- Site doesn't load: Project does not contain an index.html file (required for GitHub Pages).
- Deployment fails: Check if you chose the right platform.
Choosing the Right Platform
| Project Type | Recommended Platform |
|---|---|
| Basic website (HTML/CSS/JS) | GitHub Pages |
| Frontend frameworks (React) | Netlify or Vercel |
| Full-stack or backend apps | Render |
Conclusion
Deployment may feel confusing at first, but once you go through it step by step, it becomes very clear.Start simple. Upload your project to GitHub. Then deploy it using GitHub Pages or Netlify. After doing this once, you will realize that deployment is just a repeatable process.
Frequently Asked Questions
1. Can a complete beginner deploy a project using this guide?2. Do I need to pay anything to deploy my project?Yes, a beginner can follow this guide successfully because each step has been explained in detail with clear instructions.
3. What kind of projects can be deployed using GitHub Pages?No, all the platforms mentioned in this guide, including GitHub Pages, Netlify, and Vercel, offer free plans.
4. What should I do if my deployment fails?GitHub Pages supports only static projects such as HTML, CSS, and JavaScript websites.
5. Can I update my website after deployment?You should check your error messages carefully, verify your Git commands, and ensure your project structure is correct.
Yes, you can update your project anytime. You just need to make changes locally and push the updated code to GitHub again.
0 Comments