heroku / legacy-cli

Heroku CLI
https://cli.heroku.com
MIT License
1.36k stars 381 forks source link

CLI app:Create fails to handle removal of existing 'heroku' git remote #2032

Open hillct opened 7 years ago

hillct commented 7 years ago

In the edge case of an app being deployed (successfully) via CLI, then deleted via the web dashboard, then deployed again via the CLI using the command:

heroku cerate

The process appears to complete, reporting no errors, however the 'heroku' remote has not been updated even egardless of there being no error presented. Issuing 'git push heroku master' Will fail at this point. A review of:

git remotes -v

shows that the 'heroku' remote has not been updated to reflect the new repository for the new app created above. Instead, it will reflect the repository of the previously created app (deleted via the web dashboard).

The workaround here once he underlying bud is identified - a manual remove and re-add of he 'heroku' remote via the commands:

git remote remove heroku git remote add heroku

Once this is step is performed manually, the user can continue as normal to:

git push heroku master

with a successful result.

These tests were performed using the 'node-js-getting-started' app demo however, the same results can b generated using any properly functioning app/repo for any runtime.

The resolution should be to add a check for an existing remote having the name 'heroku' and removing it if it exists, in the sequence of git commands issued locally by the CLI as part of the 'heroku create' processing flow.

jdx commented 7 years ago

We only add the git remote if there isn't already one there. We can't remove the existing one since there might be a reason the user has it there, it could be a staging server or something else labeled heroku.

Carringguns commented 7 years ago

I'm pretty lost. When I get it it moves well. Heh

simonneutert commented 7 years ago

check your current git setting of a project: cd to/your/project

then (or open it in an editor) cat .git/config

This file cannot know when you delete a repo on github ;) So this is the place to edit, when you change your heroku project.