Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push origin master fails and gives error: src refspec HEAD does not match any

Tags:

git

Any help would be great. Thanks in advance!

I have git installed, and the ssh key setup, but I'm getting this weird error.

admin@Administrators-MacBook-Pro:~/Desktop$ cd exercise/
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git init
Initialized empty Git repository in /Users/admin/Desktop/exercise/.git/
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git remote add origin [email protected]:pavankat/exercise.git
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git push origin master
error: src refspec master does not match any.
error: failed to push some refs to '[email protected]:pavankat/exercise.git'
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git push [email protected]:pavankat/exercise.git HEAD:test
fatal: remote part of refspec is not a valid name in /
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ git push [email protected]:pavankat/exercise.git HEAD:test
error: src refspec HEAD does not match any.
error: failed to push some refs to '[email protected]:pavankat/exercise.git'
admin@Administrators-MacBook-Pro:~/Desktop/exercise$ 
like image 218
Pavan Katepalli Avatar asked Jan 21 '13 19:01

Pavan Katepalli


People also ask

What does SRC Refspec master does not match any mean?

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.

What is git push origin master?

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.

What is git push origin?

Git Push Origin pushes all the branches to the main branch. Git Push Origin Master pushes your master branch to the origin. Command for this: git push origin.

How do I push to main branch GitHub?

The steps to follow in order to push new Git branches to remote repos such as GitHub, GitLab or Bitbucket are as follows: Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch.


1 Answers

so i didn't do

git add .

git commit -am 'initial commit' 

before I pushed.

:/

like image 143
Pavan Katepalli Avatar answered Oct 19 '22 20:10

Pavan Katepalli