Table of Contents

Create new repository

You want to take a local folder and push it to a new GitHub repository. Here’s a clear step-by-step guide:

1️⃣ Create a new repository on GitHub

  1. Go to GitHub and log in.
  2. Click the + icon → New repository.
  3. Give it a name (e.g., my-project).
  4. Do not initialize with a README, .gitignore, or license (we’ll push your local content).
  5. Click Create repository.

2️⃣ Initialize your local folder as a Git repository (if not already)

Open a terminal in your project folder:

cd /path/to/your/local/folder
git init

This creates a .git folder and makes your directory a Git repository.

3️⃣ Add and commit your files

git add .
git commit -m "Initial commit"

GitHub gives you a SSH URL for the new repo, e.g.:

git@github.com:username/my-project.git

Add it as a remote:

git remote add origin git@github.com:username/my-project.git

5️⃣ Push your local content to GitHub

git branch -M main   # Ensure the main branch is called "main"
git push -u origin main

✅ After this, your local folder’s contents will appear in your new GitHub repository.