seachicken / gh-poi

✨ Safely clean up your local branches
https://dev.to/seachicken/safely-clean-up-your-local-branches-9i3
MIT License
685 stars 19 forks source link

GH Poi does not work with multiple github account workaround #39

Closed UbiquitousPhoton closed 2 years ago

UbiquitousPhoton commented 2 years ago

Description Bear with me, as this is half way between a bug report and a feature request. I am also willing to help 'fix' this, if given some pointers on where and how.

I like the extension, and would love to use it more, however... If you have used the strategy to handle multiple github accounts (a version of which is here), you potentially have a non-resolving domain in your remotes somewhere, along the lines of git@github.com-work:me/blah.git. The hack in the .ssh/config file turns this back into github.com, and everything is good as far as git goes (and the correct identity/ssh key gets used)

However, of course this doesn't work in gh-poi:

== DRY RUN ==
✕ Fetching pull requests...
failed to run external command: gh
error connecting to github.com-work
check your internet connection or https://githubstatus.com

I'm not entirely sure what I am suggesting here. Something along the lines of: If its an ssh type remote, then check ~/.ssh/config for a remapping?

I'm not entirely sure. I do know, however, that I am not the only person who uses this method, so thought I would open a conversation on it.

Additional context

None that I can think of.

seachicken commented 2 years ago

Thanks for the reporting! I will check it.

seachicken commented 2 years ago

It seems that there was an error when calling gh repo view internally. https://github.com/seachicken/gh-poi/blob/4ff37503e49730303d412e93fcde1dc94f173d71/conn/command.go#L37

example:

$ gh repo view github.com-work/seachicken/can                                                                                                                                         
error connecting to github.com-work
check your internet connection or https://githubstatus.com

I fixed it to get the correct hostname, so upgrading the extension should work. https://github.com/seachicken/gh-poi/pull/48 gh extension upgrade poi