【问题标题】:Why is this git push not allowing me to do this?为什么这个 git push 不允许我这样做?
【发布时间】:2013-09-07 02:37:20
【问题描述】:

所以我最近尝试在 git 中执行以下操作:

Username for '##### - Site': User
Password for '##### - Site':
To https://comtech.git.beanstalkapp.com/ong-sis.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '##### - Site'
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 的人。

所以我尝试了这个:

$ git push --force SISONG master
Username for '##### - Site': user
Password for '##### - Site':
Counting objects: 190, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (110/110), done.
Writing objects: 100% (111/111), 599.75 KiB | 0 bytes/s, done.
Total 111 (delta 60), reused 40 (delta 1)
remote: error: denying non-fast-forward refs/heads/master (you should pull first
)
To https://comtech.git.beanstalkapp.com/ong-sis.git
 ! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to '##### - Site'

所以最后我决定,你知道 - 让我们拉 - 让我们做它并处理合并问题。

$ git pull SISONG master
Username for '##### - Site': user
Password for '##### - Site':
From ##### - Site
 * branch            master     -> FETCH_HEAD
Already up-to-date.

对不起什么?!所以你是最新的?好吧,推那该死的东西....

现在我的公司不允许非快进推送,而且我无法联系到这个 repo 的管理员 - 有什么想法吗?

【问题讨论】:

  • this question 可能会有所帮助。您可能想存储当前的更改或先将它们放在本地分支中。
  • 不,不,我只想继续推进。
  • 我建议采用“强制”拉取方法 - 将您的更改保存在另一个分支中,使用上述问题中的方法“强制”拉取,然后合并您的本地分支并像往常一样推送..

标签: git git-push git-pull


【解决方案1】:

您不能git push,因为远程分支已经偏离了您的计算机应有的位置。可能其他人也推送了一些代码。为了解决它,您需要先git pull,然后再git push

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 1970-01-01
    • 2011-10-14
    • 2020-05-01
    • 1970-01-01
    • 2017-02-24
    • 1970-01-01
    相关资源
    最近更新 更多