How to Upload Your PHP Project to GitHub — Complete Beginner’s Guide 2026
You have built a PHP management system. It runs perfectly on your localhost. Now you need to put it on GitHub so you can share a link with employers, add it to your portfolio, and never lose it to a crashed hard drive again. This guide walks you through every single step — from installing Git to writing your first README — even if you have never used Git before.
Most CS students finish their final year project, zip it up, and store it on a USB drive that will eventually get lost. Or they email it to themselves and forget which email account they used. GitHub solves all of this permanently — your code is online, version controlled, sharable with a link, and backed up on Microsoft’s servers.
But the first time you use Git, it is genuinely confusing. Why do you need to init and add and commit and then push? What is a remote? Why does it say “rejected”? What should you put in the README? This guide answers all of it, in plain language, specifically for PHP projects coming from a XAMPP setup.
Before You Start — Understanding What Git and GitHub Actually Are
Students often confuse Git and GitHub. They are different things. Git is software that runs on your computer. It tracks every change you make to your code files — like a time machine for your project. GitHub is a website owned by Microsoft where you can store your Git-tracked projects online so anyone can see them with a link.
The relationship works like this: Git runs locally (on your machine), and GitHub is the remote destination where you send your Git history. When you “push” to GitHub, you are uploading your local Git history to GitHub’s servers. When a recruiter or collaborator “clones” your repository, they are downloading that history to their machine.
You do not need to understand everything about Git to use it effectively. This guide uses exactly the commands you need — nothing more.
Install Git on Your Computer
Git is not installed on Windows by default. Download it from git-scm.com/downloads and run the installer. You can accept all default settings during installation — nothing needs to be changed.
After installation, open Command Prompt (search “cmd” in the Windows search bar) and verify it worked by running this command:
Windows macOS / Linux Verify Git is installed
git --version
If Git is installed correctly, you will see something like git version 2.47.1.windows.1. If you see “git is not recognised as an internal or external command,” close and reopen Command Prompt, then try again. If it still fails, restart your computer.
Set up your Git identity (one time only)
Git needs to know who you are so it can label your commits. Run these two commands once — replace the details with your own name and email address. Use the same email you will use for your GitHub account.
All OS Run once after installing Git
git config --global user.name "Your Full Name"
git config --global user.email "youremail@gmail.com"
These settings are stored globally on your computer. You only need to run them once, not for every project.
Create a Free GitHub Account
Go to github.com and sign up for a free account. Your username matters more than most students realise — this will appear in every repository URL you share with employers. Use your real name in a professional format: john-smith-dev, sarah-okafor, or simply johnsmith. Avoid usernames like coder123, php_student_1999, or anything that does not look professional.
Once you have an account, go to your GitHub profile settings (click your profile picture → Settings → Profile) and fill in your name, bio, and location. A complete profile looks more credible to employers who visit your GitHub page.
Important: Apply for the GitHub Student Developer Pack at education.github.com/pack. It gives you GitHub Copilot Pro, private repositories, and dozens of other free tools verified with a student email. The process takes 1–3 days for verification.
Create a New Repository on GitHub
A repository (or “repo”) is a folder on GitHub that holds your project files and their entire history. Think of it as the online home for one project. Create one like this:
- Click the + icon in the top-right corner of GitHub and select New repository
- Name it something clear and professional. Use hyphens instead of spaces:
isp-management-systemorhospital-management-php - Add a short description: “A PHP and MySQL ISP billing and customer management system”
- Set it to Public (so employers and your portfolio can link to it)
- Do NOT tick “Add a README file,” “Add .gitignore,” or “Choose a license” — we will add these manually so there are no conflicts when you push your local project
- Click Create repository
GitHub will show you a page with commands. Do not run them yet — we have some important setup to do locally first.
hospital-management-php. Not ideal: HospitalManagement_PHP. The URL will look cleaner and more professional.
Create a .gitignore File — Protect Your Database Credentials
This is the most important security step in this entire guide. Your PHP project has a database connection file — usually called config.php, dbconnection.php, or similar — that contains your database username and password. If you upload this file to GitHub, those credentials are publicly visible to the entire internet.
A .gitignore file tells Git which files to ignore and never upload. You need to create one in your project folder before your first commit.
Open Notepad (or any text editor), create a new file, and save it as .gitignore (note the dot at the start, no file extension) inside your project’s root folder — the same folder that contains your PHP files.
Generate your .gitignore — tick what applies to your project:
🛡 .gitignore Generator for PHP Projects
Create this as config.example.php — commit this, NOT config.php
<?php
// Copy this file to config.php and fill in your database details
// NEVER commit config.php to GitHub — it is in .gitignore
define('DB_HOST', 'localhost');
define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_mysql_username');
define('DB_PASS', 'your_mysql_password');
$conn = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
Write a Professional README.md
A README is the first thing anyone sees when they visit your repository. It is a text file written in Markdown (a simple formatting language) that explains what your project is, how to set it up, and what it does. Almost every student skips this step or writes three lines. A proper README is one of the most important things that separates professional-looking repositories from student ones.
Create a file called README.md in your project root folder. Copy the template below and fill in your specific details.
Copy this template into your README.md
# 🌐 [Your Project Name]
[](https://php.net)
[](https://mysql.com)
[](LICENSE)
> A brief one-sentence description of what your system does and who it is for.
🔗 **[Live Demo](YOUR_DEMO_URL)** | 📖 **[Documentation](link)** | 🎓 Final Year Project
---
## ✨ Features
- [Main feature 1 — e.g. Admin dashboard with real-time billing summary]
- [Main feature 2 — e.g. Automated monthly bill generation for all active customers]
- [Main feature 3 — e.g. Role-based access control (Admin / Staff / Customer)]
- [Main feature 4]
- [Main feature 5]
## 🛠 Tech Stack
| Category | Technology |
|-------------|-------------------------|
| Backend | PHP 8.x |
| Database | MySQL 8.0 |
| Frontend | HTML5, CSS3, Bootstrap 4|
| Local Server| XAMPP / WAMP / Laragon |
| Version Ctrl| Git + GitHub |
## 🚀 Local Setup — Get Running in 5 Minutes
### Prerequisites
- XAMPP (or WAMP/Laragon) installed and running
- Apache and MySQL services started
- A web browser
### Installation Steps
1. Clone this repository into your XAMPP htdocs folder:
```
git clone https://github.com/YOUR-USERNAME/YOUR-REPO-NAME.git
```
2. Open phpMyAdmin at http://localhost/phpmyadmin
3. Create a new database named `isp_db` (or your project's database name)
4. Import the SQL file: Click Import → Choose `database/isp_db.sql` → Go
5. Copy the example config: `cp config.example.php config.php`
6. Open `config.php` and update with your database details:
```php
define('DB_NAME', 'isp_db'); // your database name
define('DB_USER', 'root'); // usually 'root' on XAMPP
define('DB_PASS', ''); // usually blank on XAMPP
```
7. Visit: http://localhost/YOUR-REPO-NAME/
### Default Login
| Role | Username | Password |
|-------|----------|-------------|
| Admin | admin | 12345678 |
⚠️ Change the default password immediately after first login.
## 📸 Screenshots
| Dashboard | Customer Management |
|-----------|-------------------|
|  |  |
## 🔧 Key Technical Details
**Database Design:** [Brief description of your main tables and relationships]
**Main Technical Challenge:** [Describe one specific technical problem you solved —
e.g. "Implemented duplicate-prevention logic in the billing module to ensure
only one bill per customer per month is generated, using a SQL EXISTS check
before each INSERT."]
**Security Measures:** Session-based authentication, prepared statements for
all database queries, input validation on all form fields.
## 📬 Contact
**[Your Name]** — [your.email@gmail.com]
[](YOUR-LINKEDIN-URL)
[](https://github.com/YOUR-USERNAME)
---
⭐ If this project helped you, please give it a star on GitHub!
Navigate to Your Project Folder in Command Prompt
Open Command Prompt (Windows) or Terminal (macOS/Linux). You need to navigate to your PHP project folder — the same one you have inside your XAMPP htdocs directory. Use the cd command to change directories.
Windows Navigate to your project in XAMPP htdocs
# Replace "isp-management-system" with your actual project folder name
cd C:\xampp\htdocs\isp-management-system
# Confirm you are in the right folder — lists all files
dir
macOS Navigate to your project in MAMP
# Replace "isp-management-system" with your actual project folder name
cd /Applications/MAMP/htdocs/isp-management-system
# Confirm you are in the right folder
ls
You should see your PHP files listed. If you do not see them, check your path — the folder name must match exactly, including capital letters.
Run the Git Commands — Upload Your Project
Now the main event. Run these commands in order, one at a time. Read what each one does before running it — understanding the commands makes everything that follows much easier.
Run these commands in order — read each comment first
# Step 1: Initialise Git in your project folder
# Creates a hidden .git folder that tracks all your changes
git init
# Step 2: Check what Git can see — should show your files
# Files in red = untracked. Files that should NOT be here = your .gitignore is wrong
git status
# Step 3: Stage all files for your first commit
# The dot (.) means "everything in this folder"
# Git will automatically skip anything listed in .gitignore
git add .
# Step 4: Check staged files — everything should now be green
git status
# Step 5: Make your first commit
# This saves a snapshot of your project with a message describing what it is
git commit -m "Initial commit: ISP Management System in PHP and MySQL"
# Step 6: Rename the default branch from 'master' to 'main'
# GitHub uses 'main' by default since 2020 — this keeps them consistent
git branch -M main
# Step 7: Connect your local project to your GitHub repository
# IMPORTANT: Replace YOUR-USERNAME and YOUR-REPO-NAME with your actual details
git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO-NAME.git
# Step 8: Push your project to GitHub
# -u sets 'origin main' as the default — future pushes only need 'git push'
git push -u origin main
After running git push, Git will ask for your GitHub username and password. Important: GitHub no longer accepts your account password for this. You need to use a Personal Access Token instead. Here is how to get one:
Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token. Give it a name, select “repo” under scopes, generate it, and copy the token immediately — it is only shown once. Use this token as your password when Git asks.
https://github.com/YOUR-USERNAME/YOUR-REPO-NAME to see it.
Add Your Live Demo Link and Polish Your Repository
A GitHub repository with no live demo link is significantly less impressive than one that has a working URL a recruiter can click. Do these three things to finish your repository professionally:
- Deploy your project live — upload it to InfinityFree (free forever, no credit card) or Hostinger. See our hosting guide for step-by-step deployment instructions.
- Add the live demo URL to your repository — on your GitHub repository page, click the gear icon next to “About” and paste your live URL in the Website field. This URL appears prominently on your repository’s homepage.
- Add topic tags — in the same “About” edit area, add tags like
php,mysql,management-system,xampp. These make your repository discoverable in GitHub’s search.
How to Update Your Repository After Making Changes
Once your project is on GitHub, every time you make improvements you should push the updates. This keeps your GitHub repository current and shows a healthy commit history — one of the things recruiters notice when they browse your profile.
Run after making any changes to your project
# See what changed since your last commit
git status
# Stage all changes (or replace . with specific filename)
git add .
# Commit with a descriptive message — NOT "update" or "fix"
git commit -m "Add PDF export feature to billing module"
# Push to GitHub — since you used -u earlier, this is all you need
git push
How to write good commit messages
Your commit messages are visible on your GitHub profile. Recruiters and technical interviewers sometimes look at them. Good commit messages show that you think clearly and communicate professionally. Bad ones signal sloppy habits.
❌ Poor commit messages
- update
- fix
- asdf
- changes
- final final FINAL
✓ Professional commit messages
- Add session timeout to admin login
- Fix duplicate bill generation bug
- Add PDF export to billing report
- Update README with setup instructions
- Implement ChatGPT chatbot widget
Troubleshooter — Fix the Most Common Git Errors
Cause: You tried to push before making any commits. Git cannot push a branch that has no commits yet.
Fix: Make sure you have run git add . and git commit -m "Initial commit" before running git push. Run git log after committing — if you see a commit entry, you are ready to push.
Cause: Your GitHub repository has files (like an auto-created README.md) that are not in your local project. Git refuses to overwrite them.
Fix: Run git pull origin main --allow-unrelated-histories to merge the remote content, then git push origin main. In future, avoid ticking “Add a README file” when creating a new repository — create the README locally instead.
Cause: GitHub stopped accepting passwords for Git operations in 2021. You must use a Personal Access Token instead.
Fix: Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token. Give it “repo” scope. When Git asks for your password, paste this token. To avoid entering it repeatedly, run: git config --global credential.helper store (your credentials are then saved on your machine).
Cause: The .gitignore was not created before the first commit, so config.php was tracked and pushed.
Immediate action: (1) Change your database password immediately — assume it is compromised. (2) Remove config.php from Git tracking without deleting the file: git rm --cached config.php. (3) Add config.php to your .gitignore. (4) Commit: git commit -m "Remove config.php from tracking". (5) Push. Note: the credentials are still in your Git history — to fully remove them from history requires more advanced steps (git filter-branch or BFG Repo-Cleaner). For a student project, changing your password and removing the file from tracking is the minimum required action.
Cause: Git does not see any new changes. Either you have already committed everything, or the files you changed are in .gitignore.
Fix: This is usually not an error — it means everything is up to date. If you expected to see changes, run git status to see what Git can see. If your changed file is listed in .gitignore, Git is intentionally ignoring it — which is correct if it is a config file.
Git Command Cheat Sheet — Save This
⚡ Essential Git Commands for PHP Developers
Frequently Asked Questions
Should my repository be Public or Private?
For portfolio projects that you want employers to see, make them Public. Public repositories are visible to anyone without a GitHub account and can be linked to from your CV and portfolio website. Private repositories are only visible to you (and anyone you invite) — useful for work in progress or anything containing genuinely sensitive client information. If you have the GitHub Student Developer Pack, you get unlimited private repositories free, which is useful for keeping your “work in progress” projects tidy until they are ready to share. When your project is polished and complete, switch it to public.
Do I need to upload the SQL database file to GitHub?
Yes — you should include the SQL file so that anyone cloning your repository can import the database structure. Create a folder called database inside your project and put your exported SQL file there (export it from phpMyAdmin using the Export tab). Do NOT export data from a database that contains real people’s personal information — only export the table structure and any dummy/sample data you created for demonstration. The SQL file should allow someone to set up the database schema without containing any real user data.
My project is inside xampp/htdocs/ — should I push the entire htdocs folder?
No — only push your specific project folder, not the entire htdocs directory. Navigate into your project folder specifically (for example, cd C:\xampp\htdocs\isp-management-system) and run git init from inside there. This means your repository will only contain the ISP project files, not every other project in your htdocs. Each project should have its own separate GitHub repository.
Can I use GitHub Desktop instead of the command line?
Yes. GitHub Desktop is a free graphical application that lets you do all the same Git operations (commit, push, pull, clone) without typing commands. Download it from desktop.github.com. It is easier to start with than the command line, and handles authentication automatically. The downside: learning the command line version is more valuable for your career — most professional developer workflows and job interviews reference command line Git, not graphical tools. Consider using GitHub Desktop to start, but work toward understanding the commands from this guide.
How large can my repository be? My project has images and video files.
GitHub recommends keeping repositories under 1GB total, with individual files under 100MB. For most PHP management system projects, this is not an issue — PHP, CSS, JS, and SQL files are all very small. If your project includes large image assets, video files, or large binary files, add them to your .gitignore and host them separately (on your live hosting server), or use Git LFS (Large File Storage) for files over 50MB. For student projects, the safest approach is to gitignore the uploads folder and note in your README that user uploads are not included in the repository.
What if my project has errors that I have not fixed yet — should I still push it?
For a portfolio repository that you are actively sharing with employers: fix the errors first if they prevent the core functionality from working. A project that crashes on the login page is worse than no project at all. However, if the errors are minor (styling issues, edge case bugs) and the main functionality works, it is better to have it up with honest notes in the README (“known issue: the export function does not work in Internet Explorer”) than to wait indefinitely until it is perfect. Real-world software always has known issues — being able to document them honestly is a professional skill.
Related Tutorials on Codezips
Last updated: April 2026. Git commands and GitHub authentication details verified against official GitHub documentation. Personal Access Token requirement confirmed from GitHub blog post on authentication changes.


