DEV Community

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

Posted on

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

Top comments (0)