public:new_repo
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
- Go to GitHub and log in.
- Click the + icon → New repository.
- Give it a name (e.g.,
my-project). - Do not initialize with a README,
.gitignore, or license (we’ll push your local content). - 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"
git add .stages all files.git commit -m "Initial commit"saves the snapshot locally.
4️⃣ Link your local repo to GitHub
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
- The
-uflag setsorigin/mainas the default upstream for future pushes.
✅ After this, your local folder’s contents will appear in your new GitHub repository.
public/new_repo.txt · Last modified: by admins_ceab
