Start a Fresh Repository Locally and Push It to GitHub
Create a project folder, initialize Git, craft the first commit, and publish it to a new remote.
When to use
Start here when you are bootstrapping a brand new project that is not yet tracked in GitHub (or any remote).
Checklist
- You have a project name and a local folder path in mind.
- You have a GitHub personal access token or SSH access ready if your organization requires it.
Steps
-
Create the project directory and switch into it.
mkdir todo-api && cd todo-api -
Initialize the repository and confirm the default branch name.
git init git status -
Add any starter files and make your first commit.
echo '# Todo API' > README.md git add README.md git commit -m "chore: bootstrap project" -
Create the matching empty repository in GitHub (via the web UI or the
ghCLI) without initializing it with a README. -
Wire up the remote and push the branch.
git remote add origin [email protected]:your-user/todo-api.git git push -u origin main
Verification
git remote -vshows the URL you expect.- The repository page on GitHub displays your README and initial commit.
Follow-up
- Add a license file if the project is public.
- Set up branch protection rules in GitHub before collaborating.