Step 1: Create GitHub Repo
- Open GitHub and click New repository.
- Give your repository a name.
- Create it as an empty repository.
- Do not add README or .gitignore if your local project already has files.
You already built your project on your computer. This guide shows exactly how to upload it to GitHub with clean, copy-paste commands anyone can follow.
Open terminal inside your project folder and run:
git init
git add .
git commit -m "Initial commit"
Replace YOUR_USERNAME and YOUR_REPO_NAME:
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
git remote -v
git remote add origin git@github.com:YOUR_USERNAME/YOUR_REPO_NAME.git
git remote -v
git branch -M main
git push -u origin main
For your next updates use:
git add .
git commit -m "Describe what you changed"
git push
git remote remove origin
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
git pull origin main --rebase
git push
Initialize Git in your local folder, commit your files, set remote origin, then push to your main branch.
Remove old remote using git remote remove origin and add the new one using your GitHub repo URL.
No. Keep secrets out of Git. Add .env in .gitignore before you push.