np icon indicating copy to clipboard operation
np copied to clipboard

GitHub Enterprise URLs aren't supported

Open ericclemmons opened this issue 6 years ago • 7 comments

It also appears that github-url-from-git doesn't support non-GitHub URLs, which is part of the problem.

Opening this ticket so I can research further.

ericclemmons avatar Mar 04 '19 22:03 ericclemmons

Which URL are you using (feel free to censor out the sensitive parts, I just want to reproduce this)? Also, looking at github-url-from-git's readme, it seems like they do support GitHub Enterprise URL's.

If this is an issue specific to github-url-from-git, you should open an issue over there.

itaisteinherz avatar Mar 05 '19 07:03 itaisteinherz

I'm encountering the same issue. The value of repository.url in my package.json is [email protected]:org-name/repo-name.git.

Based on the github-url-from-git's readme, it looks like you need to pass in the enterprise base URL via the extraBaseUrls option.

privatenumber avatar Mar 13 '19 07:03 privatenumber

I'm happy to open a PR, but I'm not sure if the right solution is to:

  1. Let the user pass in --git-base-urls to configure github-url-from-git's extraBaseUrls option
  2. Write some logic that would automatically detect the baseUrl of a git

privatenumber avatar Mar 15 '19 22:03 privatenumber

#1 sounds good to me.

itaisteinherz avatar Mar 15 '19 22:03 itaisteinherz

Great! After that's added, the enterprise repo url will get passed into hosted-git-info. Unfortunately, hosted-git-info doesn't support enterprise URLs.

It's possible that the repo URL is on an enterprise Bitbucket too.

Does a --is-github flag to override this step sound sufficient?

privatenumber avatar Mar 16 '19 00:03 privatenumber

I don’t want a new flag unless absolutely necessary. Seems you can fix it by improving these dependencies instead, so I’d rather see that. Also, improving those packages will benefit everyone, not just np.

sindresorhus avatar Mar 16 '19 05:03 sindresorhus

That dependency is dead but I think it can be replaced by npm’s own resolver: https://www.npmjs.com/package/hosted-git-info

fregante avatar Feb 03 '23 10:02 fregante