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,570 points
19,802 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
• 52,370 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
• 7,040 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
• 7,040 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
1 answer
+2 votes
3 answers
+1 vote
1 answer

master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:abc70/new.git'

Hi@akhtar, To update your local repo to GitHub ...READ MORE

answered Feb 14, 2020 in Git & GitHub by MD
• 95,320 points
13,037 views
–1 vote
1 answer
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,326 views
+2 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
• 52,370 points
855 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
8,511 views