DEV Community

Cover image for Error-: src refspec main does not match
Shafia Rahman Chowdhury
Shafia Rahman Chowdhury

Posted on

1

Error-: src refspec main does not match

Error-: src refspec main does not match any

Image description

This error message usually indicates that the branch you're attempting to push does not exist.

Solution-1

Check if you have missed the command git add . or git commit -m"message. If so, then delete the terminal and write the git commands again.

Solution-2

Step 1: Go to GitHub Settings and then go to Emails

Step-2: Uncheck Keep my email addresses private

Image description

Step-3: Push your code again

Solution-2

Open your Git bash terminal and run the following commands one by one:



rm -rf .git
git init
git add .
git commit -m "added"
git branch -M main
git remote add origin <YOUR_GITHUB_REPO_LINK>
git push -u origin main -f


Happy Coding!
Enter fullscreen mode Exit fullscreen mode

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs