heroku / heroku-repo

Plugin for heroku CLI that can manipulate the repo
MIT License
689 stars 114 forks source link

repo:rebuild does not work w/ two apps in the same repo #16

Closed kennknowles closed 10 months ago

kennknowles commented 10 years ago

heroku repo:rebuild cannot read my application's remote from my git config because there are two applications with different remotes (production and staging)

So it defaults to a remote named heroku which does not exist.

Suggested behavior:

  1. Figure out the remote some other way, like from the --app parameter. I don't know much about Heroku plugins so I don't know if this is possible.
  2. Add a flag --remote that the user must pass. If they do not, then print a useful message and exit 1.

I'm not that picky about my own configuration, if you have any suggestions.

jonathan-mui commented 10 years ago

Same issue here. The assumption of pushing to heroku remote is actually dangerous because that may not be the remote of the app a user is wishing to rebuild.

rehno-lindeque commented 10 years ago

:+1:

abhishekmunie commented 10 years ago

khoan commented 10 years ago

just got bitten by this...is there a workaround other than to git push afresh to heroku?

error log here: https://gist.github.com/khoan/753927225c120739b3aa

svenfinitiv commented 10 years ago

:+1:

dmathieu commented 10 years ago

This "problem" is the same as with all toolbelt commands. You should be able to specify an app's name with the -a option.

heroku repo:purge_cache -a <app name>

It's even specified in the README, and I just tried to confirm that it works properly.

10io commented 10 years ago

I can confirm that it doesn't work even with the -a flag.

I have the exact same situation as @kennknowles : one application with two remotes (production and staging and the command ends up with:

~/tmp/repo_tmp/unpack $ exit
exit
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The issue appears to be not having a remote named heroku.

My working workaround was:

$ heroku git:remote -r heroku -a the_application_name
$ heroku repo:rebuild -a the_application_name
$ git remote rm heroku
jkwatson commented 9 years ago

It would be really great if this didn't require a workaround. I'm in this position, as well, as we have both the stage & production remotes, named as such, and neither remote is named 'heroku'.

csphere commented 9 years ago

Would love a patch.

Just need the ability to pass in an -r option for what the remote is named and inject it on line 108 of https://github.com/heroku/heroku-repo/blob/master/lib/heroku/command/repo.rb

jkwatson commented 9 years ago

Is there a way to have it also respect the standard heroku --remote xyz method of selecting a heroku app? I don't know much about how these plugins work at all.