【问题标题】:Source Forge repo gives "denying non-fast-forward refs/heads/master" errorSource Forge repo 给出“拒绝非快进 refs/heads/master”错误
【发布时间】:2012-09-16 21:01:40
【问题描述】:

我rewrote the tree to my git repository to fix errors in the author name and email address。现在我正在尝试将固定树推送到我在 Source Forge 上的存储库。 CharlesB told me how to update the config file on the Source Forge servers。我的配置文件如下所示:

[codeguru@shell-24003 bbct]$ cat config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedrepository = 2
[receive]
        denyNonFastforwards = false

现在当我尝试强制推送时,出现以下错误:

$ git push -f
Password:
Counting objects: 464, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (148/148), done.
Writing objects: 100% (452/452), 470.65 KiB, done.
Total 452 (delta 268), reused 417 (delta 247)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To ssh://codeguru@git.code.sf.net/p/bbct/code
 ! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://codeguru@git.code.sf.net/p/bbct/code'

这里发生了什么?更重要的是,我该如何解决?

更新:

在公共校园计算机上运行 git push -f 会给出与上述相同的错误消息。

另一个更新:

我将 SF repo 克隆到一个临时文件夹,将此临时 repo 的 master 分支重置为第一次提交之前的提交,使用错误的作者和电子邮件,然后运行 ​​git push -f。我收到与原始存储库完全相同的错误消息:

$ git push -f
Password:
Total 0 (delta 0), reused 0 (delta 0)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To ssh://codeguru@git.code.sf.net/p/bbct/code
 ! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://codeguru@git.code.sf.net/p/bbct/code'

我猜 SF 真的不希望我在这里做一个非快进提交:-(

【问题讨论】:

  • 所以和你上一个问题一样的错误?
  • 是的,看起来是这样。除了现在,我没有收到“权限被拒绝”错误。我现在也在另一台机器上。
  • so 在原机push -f 上工作,而不是在这台上?
  • @CharlesB git push -f 在任何一台机器上都不起作用。另一台机器上的最新错误在stackoverflow.com/questions/12449230/moving-remote-branch/…底部的“更新”部分中
  • @ron190 感谢您的链接。希望它能对未来的读者有所帮助。

标签: git version-control


【解决方案1】:

这可能是一个简单的案例:

[receive]
        denyNonFastForwards = false

注意“Forwards”的大写“F”。
因此,在 Source Forge 服务器上修复您的配置文件,您的 git push -f 应该可以从任何工作站成功。

【讨论】:

  • ooo...感谢您指出这一点。我不记得编辑变量名了,但我会仔细检查。
  • 好吧,我试过了,仍然得到同样的错误信息。我向 SF 支持提交了一张票。希望我能尽快收到他们的回复。
【解决方案2】:

嗯,这实际上是 SourceForge 问题,也可能是用户错误。在 SF shell 中,我最初在 /home/scm_git 目录下为我的项目编辑了配置文件。向顺丰提交ticket后,发现正确的目录是/home/git。在为我的项目编辑正确子目录中的配置文件后,我强制推送并成功更新了 master 分支。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-17
    • 1970-01-01
    • 2015-11-20
    • 2018-12-25
    • 1970-01-01
    • 2012-06-29
    • 1970-01-01
    相关资源
    最近更新 更多