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