error: src refspec master does not match any. error: failed to push some refs to 'ssh://xxxxx.com/project.git'

0 votes

I cloned my repository with:

git clone ssh://xxxxx/xx.git 

but after I made a few changes, I tried pushing these changes I got the following error

error: src refspec master does not match any.  
error: failed to push some refs to 'ssh://xxxxx.com/project.git'
Aug 17, 2018 in Git & GitHub by Hannah
• 18,060 points
10,077 views

4 answers to this question.

0 votes

you probably haven’t committed those changes and you’re trying to push them.

Commit them first and then push.

answered Aug 17, 2018 by Kalgi
• 51,890 points
0 votes

For me I had to make sure the public key is properly configured in the server (appended in ~/.ssh/authorized_keys) and in github/bitbucket (added to my SSH keys on github or bitbucket) - they need to match.

Then:

git add --all :/
git commit -am 'message'
git push -u origin master

Worked for me in the end.

answered Aug 17, 2018 by Nilesh
• 6,970 points
0 votes

Try this, it worked for me

touch README
git add README
git add (all other files)
git commit -m 'reinitialized files'
git push origin master --force  # <- caution, --force can delete others work.
answered Aug 20, 2018 by Nilesh
• 6,970 points
0 votes

The error is due to the fact that the repository is empty, you have to first make a commit.

git commit -m "initial commit"

git push -u origin master
answered Feb 25, 2019 by lystun
To those who has the same problem, just go to manage branches and remotes under version control, then add up the branches you are trying to push the changes, click track, then thats it

Related Questions In Git & GitHub

+1 vote
2 answers
+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,420 points
536 views
0 votes
1 answer
0 votes
1 answer

gerrit-cherry-pick:fatal: 'origin' does not appear to be a git repository

The user account making that command does ...READ MORE

answered Aug 13, 2018 in Git & GitHub by Kalgi
• 51,890 points
405 views
+1 vote
4 answers

GIT plugin in jenkins not able to connect to GIT repository

This looks like a git configuration issue, ...READ MORE

answered Oct 25, 2018 in Git & GitHub by Alia
4,819 views