You want to take a local folder and push it to a new GitHub repository. Here’s a clear step-by-step guide:
my-project)..gitignore, or license (we’ll push your local content).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.
git add . git commit -m "Initial commit"
git add . stages all files.git commit -m "Initial commit" saves the snapshot locally.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
git branch -M main # Ensure the main branch is called "main" git push -u origin main
-u flag sets origin/main as the default upstream for future pushes.✅ After this, your local folder’s contents will appear in your new GitHub repository.