Skip to main content

Posts

Showing posts from 2021

error: src refspec main does not match any

$ git push -u origin main error: src refspec main does not match any error: failed to push some refs to 'https://gitlab.com/jay2tinku/my-new-project.git' If you get such error while performing any git operation. This means you have to check your default branch name. From last few git versions by default branch name is main instead of master . It never means that it will always be main/master . Normally at the time of installation we have to configure that but most of the time we ignore that and go with default options. Simple fix of this error is :- git push -u origin master or git push -u origin main Please have a look on below scenario for complete understanding $ mkdir my-new-project $ cd  my-new-project $ git status $ git init $ cat > test.txt My first line!!! $  git status $ git remote add origin https://gitlab.com/jay2tinku/my-test-project.git $ git add . $ git status $ git commit . -m "Intial push commit" $ git push -u origin main error: src refspec main do