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
• 16,630 points
5,819 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
• 42,510 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,880 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,880 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 by lystun

Related Questions In Git & GitHub

0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,280 points
73 views
0 votes
1 answer

Error: git pull fails “unable to resolve reference” “unable to update local ref”

This happens when there are unnecessary files ...READ MORE

answered Jul 26, 2018 in Git & GitHub by Sophie may
• 9,870 points
1,508 views
+1 vote
5 answers
0 votes
1 answer

git error: RPC failed; curl 56 GnuTLS recv error

This is simple, you’re probably missing openssl ...READ MORE

answered Sep 26, 2018 in Git & GitHub by Tyrion anex
• 8,280 points
1,510 views
+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,380 points
216 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
• 42,510 points
260 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
2,148 views