Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github_remote_list() not picking up GHE host #1897

Open
tsahota opened this issue Sep 22, 2023 · 2 comments
Open

github_remote_list() not picking up GHE host #1897

tsahota opened this issue Sep 22, 2023 · 2 comments
Labels
bug an unexpected problem or unintended behavior git git, GitHub, and CI in general

Comments

@tsahota
Copy link

tsahota commented Sep 22, 2023

Hi I'm having trouble using usethis::use_github_release() on a GHE host:

> usethis::use_github_release()
Error in `stop_bad_github_remote_config()` at usethis/R/utils-github.R:615:4:
! Unsupported GitHub remote configuration: 'no_github'Host = NAorigin = <not configured>upstream = <not configured>Neither 'origin' nor 'upstream' is a GitHub repo.

Here is my remote (note no 'github' string is present in the hostname):

> gert::git_remote_list()
# A tibble: 1 × 2
  name   url                                                  
* <chr>  <chr>                                                
1 origin https://ghe-gsk-prod.metworx.com/account/reponame

I believe the source of the issue is in github_remote_list() which contains the lines:

parsed <- parse_github_remotes(set_names(x$url, x$name))
# TODO: generalize here for GHE hosts that don't include 'github'
is_github <- grepl("github", parsed$host)

and since 'github' doesn't match anything in https://ghe-gsk-prod.metworx.com/account/reponame, this causes the issue above. The TODO comment indicates that the author was aware.

This was introduced in commit 43f6d2d and I'd be grateful if this useful function could be made to work on non 'github' matching GHE host names!

@jennybc
Copy link
Member

jennybc commented Sep 22, 2023

Yeah, basically I was waiting to see if anyone actually felt this pain. The simplest thing to do when introducing GHE support was to recognize such a host by looking for "github". I'm not entirely sure what I will do about this, but thanks for opening the issue. It's good to know that someone has banged their shins on this in real life.

In the meantime, have you considered renaming your GHE instance? 😜

@jennybc jennybc added the git git, GitHub, and CI in general label Sep 22, 2023
@tsahota
Copy link
Author

tsahota commented Sep 23, 2023

OK thanks. I've opted to make my own little version without the is_github test. But hopefully there can be an easy solution to this in future, then I can get rid of my hack and... usethis

@hadley hadley added the bug an unexpected problem or unintended behavior label Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior git git, GitHub, and CI in general
Projects
None yet
Development

No branches or pull requests

3 participants