【问题标题】:Local Git branch not pushing successfully to remote本地 Git 分支未成功推送到远程
【发布时间】:2013-06-10 21:23:08
【问题描述】:

我遇到了 git push 的问题。我创建了一个新分支,创建了一个新文件并提交了评论。然后我做了一个git push origin master。我在github上看到了变化。

但是当我执行git push 时,它不会将更改发送到远程仓库,即远程工作仓库 (https://github.com//work-repo.git)。

$ git status
# On branch mybranch
nothing to commit (working directory clean)

$ git push
Counting objects: 16, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 607 bytes, done.
Total 6 (delta 5), reused 0 (delta 0)
To https://github.com/<myuser>/work-repo.git
   16ff794..55e4338  master -> master

当我转到 www github 并尝试在远程工作存储库上执行“拉取请求”时,我看到有多个提交(来自我的其他 git 分支+当前分支),我不能只选择这个拉取请求中的这个。

早些时候,对于其他分支,git push 工作正常,并将更改发送到远程工作存储库。这次不知道是什么问题。

我应该检查什么?

更新:

当我发送git push -u origin &lt;your_local_branch_name&gt;:&lt;your_remote_branch_name&gt; 时,我会收到以下消息:

git push -u origin mybranch:master
To https://github.com/<myuser>/work-repo.git 
! [rejected] mybranch -> master (non-fast-forward) 
error: failed to push some refs to 'https://github.com/<myuser>/work-repo.git' 
hint: Updates were rejected because a pushed branch tip is behind its remote 
hint: counterpart. Check out this branch and merge the remote changes 
hint: (e.g. 'git pull') before pushing again. 
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

更新: 由于我无法弄清楚这一点并且没有得到任何回应,我清理了 repo 并从远程重新分叉并重新开始。

Mods:请立即关闭此问题。

谢谢。

【问题讨论】:

    标签: git branch push git-remote


    【解决方案1】:

    试试这个:

    git push -u origin <your_local_branch_name>:<your_remote_branch_name>
    

    -u 标志使您的本地分支可跟踪,所以下次如果您只是执行git push origin,它将知道推送到哪里。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-25
      • 2011-09-10
      • 2016-07-08
      • 1970-01-01
      • 2012-07-25
      • 2016-02-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多