I have tried to follow the solutions suggested in this post but it didnt work and I am still getting: src refspec master does not match any.
Here is what I did: Followed this solution
// adding the file I created $ git add . $ git commit -m 'initial commit' $ git push origin master error: src refspec master does not match any.
When doing:
$ git push origin HEAD:master b40ffdf..a0d1423 HEAD -> master // looks promising // adding a remote $ git remote add devstage -f <another git> $ git merge devstage/master -s recursive -X ours $ git push -u devstage master error: src refspec master does not match any.
More information:
$ git branch * origin $ git show-ref refs/heads/origin refs/remotes/devstage/master refs/remotes/origin/HEAD refs/remotes/origin/devstage refs/remotes/origin/master refs/remotes/origin/origin
So I am definitely missing refs/heads/master but dont know how to create it.
Thanks
The solution to this error is to either create a local and remote master branch that you can push the commit to or to push the commit to an existing branch – maybe main . These commands will create a master branch locally. And by pushing to origin master , the master branch will also be created remotely.
The “src refspec master does not match any” error occurs if you have forgotten to add the files you have changed to a commit and try to push those changes to a remote repository before you make the first commit in your repository.
The most probable reason for this error is that all the files are untracked and have not been added. git add --all in case you wish to add all the files Or you can selectively add files. Then git commit -m "Initial comment" , git push origin master . This will surely work.
Whenever we need to push the changes to a remote repository, we use git push along with the remote repository “origin” and “master” branches. The term used is “git push origin master“. To pull the changes from the remote repository to local, we use git pull along with remote repository “origin” and “master” branch.
This should help you
git init git add . git commit -m 'Initial Commit' git push -u origin master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With