You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行git push heroku master时触发Invalid refspec错误求助

Fixing "fatal: Invalid refspec" When Pushing to Heroku

Hey there, let's get this push error sorted out quickly. The problem here is your local Git repository is still linked to your old Heroku app (damp-reef-82414) instead of the new one you created (lit-earth-17372). That's why you're seeing the invalid refspec error—Git can't resolve the old repo URL correctly for your current project.

Here's how to fix it step by step:

  • First, check your current remote repository settings to confirm the issue:

    git remote -v
    

    You'll probably see the old damp-reef-82414 URL listed under the heroku remote.

  • Next, update the heroku remote to point to your new app's Git URL. You can do this in two ways:

    1. Option 1: Update the existing remote URL (faster if you don't want to remove anything):
      git remote set-url heroku https://git.heroku.com/lit-earth-17372.git
      
    2. Option 2: Remove the old remote and add the new one:
      git remote remove heroku
      git remote add heroku https://git.heroku.com/lit-earth-17372.git
      
  • Finally, try pushing again:

    git push heroku master
    

This should resolve the refspec error because Git will now be targeting the correct Heroku app repository you created with heroku create.

内容的提问来源于stack exchange,提问作者Mohit

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:21:25