** 情形:**在本地分支local_branch修改了代码,之后要提交到远程分支remote_branch上,使用命令git push origin remote_branch报错。

** 报错:**
error: src refspec remote_branch does not match any
error: failed to push some refs to ‘http://****.git’

** 解决方案:**
git push origin local_branch:remote_branch

推送本地分支local_branch到远程分支 remote_branch并建立关联关系

  a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch

      git push

 b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch

     git push -u origin/remote_branch

 c.远程没有remote_branch分支并,本地已经切换到local_branch

    git push origin local_branch:remote_branch
Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐