简体   繁体   中英

Trying to push code to specific branch on GitHub Online

I'm running into this weird problem. I have a branch in remote that I cloned from a branch online and I'm trying to push my changes to the online branch using "git push origin custom-loss" but then it says "error: src refspec custom-loss does not match any", but then when I do git pull origin custom-loss it says "Already up to date." So I know it's finding the branch online just not when I push.

The error “src refspec custom-loss does not match any” means that you don't have a local branch called custom-loss . When you run git pull origin custom-loss , it pulls the changes from the remote side's custom-loss branch into your current branch, but it doesn't necessarily create the branch for you if it doesn't exist.

It may happen to exist as refs/origin/custom-loss (which you would normally write as origin/custom-loss ), but that's a remote tracking branch, not a normal branch.

If your branch is named something else (say, foo ) and you want to push it to the remote custom-loss branch, you can say, git push origin foo:refs/heads/custom-loss and it will push your changes there. You can also rename your branch with git branch -m custom-loss and then use your original command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM