Ruby: 解决 "failed to push some refs to '[...]'"

本文件是故障排除指南的一部分。您可以在这里查看完整指南:您的 Ruby 服务遇到问题了吗?解决方案可能就在这里!

👋 欢迎来到 Stackhero 文档!

Stackhero 提供现成的 Ruby cloud 解决方案,具有众多优势,包括:

  • 通过简单的 git push 在几秒钟内 部署您的应用程序。
  • 使用您自己的域名,并享受 HTTPS 证书的自动配置以增强安全性。
  • 享受 自动备份一键更新,以及简单、透明和可预测的定价带来的安心。
  • 通过专用私有 VM获得最佳的性能和强大的安全性

节省时间简化您的生活:只需 5 分钟即可试用 Stackhero 的 Ruby cloud hosting 解决方案!

此错误可能在部署期间出现:

error: failed to push some refs to '[...]'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

此消息表明您的实例上的 Git 仓库包含本地不存在的内容。要继续,您可以使用以下命令强制同步:

git push -f stackhero main