search

Home  >  Q&A  >  body text

git push original branch error src refspec xxx does not match any

First of all, this is a project done by others and I want to iterate now

The sequence of operations is as follows
git config --global user.email ""
git config --global user.name ""
Submit it to the local warehouse for the first time
git add .
git commit
Submit to the remote warehouse
git remote add origin git@xxx

git pull orgin xxx
Note that pull here can be pulled
but push will return an error

The error message is as follows:
error: src refspec xxx does not match any.
error: failed to push some refs to 'git@'

I searched stackOverflow and there is a solution
git push origin HEAD:branch

But I would like to ask if there is any way to restore it to the following method?
git push origin xxx

And the push here shows root in the git.log log file

阿神阿神2788 days ago733

reply all(2)I'll reply

  • PHPz

    PHPz2017-05-02 09:39:30

    Thank you for the invitation. You can execute itgit pull origin 分支,执行git push origin 分支就出错!好神奇啊!你在你本地执行ssh –T git@github.comTry it and see what happens

    reply
    0
  • 某草草

    某草草2017-05-02 09:39:30

    Your remote warehouse doesn’t have a corresponding branch, how do you push it?

    git push -u origin master
    Username for 'https://github.com': yourusername
    Password for 'https://yourusername@github.com': 
    error: src refspec master does not match any.
    error: failed to push some refs to 'https://github.com/yourusername/foobar.git'
    //解决方案:
    
    git init
    git add .
    git commit -m 'message'
    git *create remote
    git push -u origin master

    reply
    0
  • Cancelreply