Home > Net >  Can't push new local branch to remote repo
Can't push new local branch to remote repo

Time:12-06

I always create a new feature branch (git checkout -b feature-branch) that I push (after doing git add . and git commit "...") to remote repo by doing this:

git push origin feature-branch

Inexplicably, the same process failed today with the following error:

error: src refspec feature/feature-branch does not match any
error: failed to push some refs to 'https://bitbucket.org/myproject/myproject.git'

(note the sentence of the first line isn't even complete)

Why is this happening and how to solve this problem?

CodePudding user response:

I'm pretty sure you are not pushing to the right branch or is there a typo error and this could be a probelm since your local branch and target branch should be same.. check out your current working branch name with this command git show-branch.

If that doesn't work try

git init

git add .

git commit -m "Your first commit message"

  •  Tags:  
  • git
  • Related