Add an Existing Project to GitHub
Push a local project directory to a new GitHub repository using SSH or HTTPS.
Step 1 – Create a new repository on GitHub
On GitHub, click New repository. Do not initialise it with a README, .gitignore, or licence — these will conflict when you push.
Step 2 – Initialise Git in your local project
cd /path/to/your/project
git init
git add .
git commit -m "Initial commit"
Step 3 – Connect to the remote and push
# Using SSH (recommended)
git remote add origin git@github.com:USERNAME/REPO.git
# Using HTTPS
git remote add origin https://github.com/USERNAME/REPO.git
git branch -M main
git push -u origin main
Verify
git remote -v