Whether you’re starting a new project or uploading an existing one, pushing a local folder to GitHub helps you track changes, collaborate, and share your work. This guide walks you through the process from start to finish using Git and GitHub.
🛠️ Prerequisites
Before you begin, make sure you have:
- A GitHub account
 - Git installed on your machine
 - A local folder/project you want to upload
 
🚀 Steps to Push a Folder to GitHub
✅ 1. Create a Repository on GitHub
- Go to GitHub
 - Click New repository
 - Enter a name, choose visibility (public/private), and click Create repository
 - Do not initialize with README if you’re pushing an existing folder
 
GitHub will now show you commands to push a project. Let’s do it locally.
📂 2. Open Terminal and Navigate to Your Folder
cd path/to/your-folder
This is the folder you want to push to GitHub.
🧰 3. Initialize a Git Repository
If this is not already a Git project:
git init
This creates a .git folder and begins tracking changes.
➕ 4. Add and Commit Your Files
git add .
git commit -m "Initial commit"
This stages and commits all files in the folder.
🌐 5. Add Remote Repository
Copy the URL of your GitHub repo (e.g., https://github.com/yourusername/your-repo.git) and run:
git remote add origin https://github.com/yourusername/your-repo.git
☁️ 6. Push to GitHub
git push -u origin main
If your local branch is named
master, replacemainwithmaster:git push -u origin master
You may be prompted to log in or authenticate via token or SSH, depending on your setup.
🎉 Done!
Visit your GitHub repository page — your folder and files should now be visible there.
🔁 Quick Summary
| Step | Command | 
|---|---|
| Navigate to folder | cd your-folder | 
| Initialize Git | git init | 
| Stage files | git add . | 
| Commit changes | git commit -m "Initial commit" | 
| Link to GitHub repo | git remote add origin <repo-url> | 
| Push to GitHub | git push -u origin main | 
🧠 Pro Tips
- Add a 
.gitignorefile to exclude unnecessary files (e.g.,node_modules,*.log) - Use SSH keys for secure and easy GitHub authentication
 - For future pushes, use just: 
git add . git commit -m "Your message" git push