What I Wanted to Do

Push a local project to GitHub for the first time.

Steps

1. Create a Repository on GitHub

  1. Log in to github.com
  2. Top right ”+” → “New repository”
  3. Enter a repository name → “Create repository”

2. Initialize Git Locally

git init
git add .
git commit -m "first commit"

3. Connect to GitHub and Push

git remote add origin https://github.com/YOUR_USERNAME/REPO_NAME.git
git branch -M main
git push -u origin main

Common Pitfalls

  • If you add a README when creating the repo on GitHub, the first push will cause a conflict
  • Password authentication is deprecated — use a Personal Access Token (PAT) or SSH key

Setting up SSH authentication means you never have to type a password. See Generate an SSH Key and Add It to GitHub.

  • Fiverr - Find freelance developers and tech experts