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

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

👋 欢迎来到 Stackhero 文档!

Stackhero 提供即开即用的 Ruby cloud 解决方案,带来多项优势,包括:

  • 只需一个简单的 git push,即可在几秒钟内部署您的应用。
  • 使用您自己的域名,并享受自动配置HTTPS证书带来的更高安全性。
  • 享受自动备份一键更新,以及简单、透明且可预测的定价,让您无后顾之忧。
  • 依托专属私有基础设施,获得卓越的性能和强大的安全性

节省时间简化您的工作流程:只需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