我正在尝试回滚 SourceForge 上的 Git 存储库。我尝试了以下方法:
git reset --hard 9ac2e31ca4a155d4c36780b4329626045a7f40ed
HEAD ist jetzt bei 9ac2e31 Fix warnings
git push -f origin master
Total 0 (delta 0), reused 0 (delta 0)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To ssh://user@git.code.sf.net/p/project/code
! [remote rejected] master -> master (non-fast-forward)
error: Fehler beim Versenden einiger Referenzen nach 'ssh://user@git.code.sf.net/p/project/code'
如何覆盖远程 SourceForge Git 存储库的 master
分支?
最佳答案
由于 denyNonFastforwards
是服务器端配置,您需要以某种方式访问 SourceForge 端的存储库。
作为您的 ticket mentions , 这是用 interactive shell service 完成的,但这假设您可以使用 ssh 打开安全 shell。
Running "
sf-help --scm
" in the shell will show you your repo paths.
Just tweak thedenyNonFastforwards = true
tofalse
for a bit, do your push, and then set it back totrue
(for safety).
但是,像“ssh:连接到主机 shell.sourceforge.net 端口 22:连接被拒绝
”这样的消息可能意味着:
- 它可能在客户端被阻止(检查您是否可以通过 SSH 连接到其他服务,例如 GitHub,即使它不是交互式 session )
- 或者它可能是 SourceForge 端(但他们的 status page doesn't report any recent incident)中断的结果
关于git - 在 SourceForge 上强制 Git 推送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31640933/