执行git push heroku master时触发Invalid refspec错误求助
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 -vYou'll probably see the old
damp-reef-82414URL listed under theherokuremote.Next, update the
herokuremote to point to your new app's Git URL. You can do this in two ways:- 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 - 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
- Option 1: Update the existing remote URL (faster if you don't want to remove anything):
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

