git-blame.nvim icon indicating copy to clipboard operation
git-blame.nvim copied to clipboard

Get remote url with `git remote get-url`

Open sarmong opened this issue 1 year ago • 2 comments
trafficstars

Current implementation uses git config --get remote.origin.url which is problematic when there is an insteadOf in git config.

E.g. I have this:

[url "[email protected]:"]
  insteadOf = "gh:"

So, git config --get remote.origin.url returns gh:user/repo and thus fails to open in a URL. Whereas git remote get-url origin will return HTTP or SSH url, that can be then used.

sarmong avatar Jun 11 '24 10:06 sarmong

Hi, yeah this makes sense. Maybe we could convert such behaviors into configurable ones via some strategy enums? I think there was a similar case a while ago that would benefit from this approach

f-person avatar Jun 12 '24 08:06 f-person

I am not sure what would be the usecase of using url from config instead of remote get-url. For example gitlinker.nvim does it this way and I haven't seen any issues raised there.

sarmong avatar Jun 12 '24 08:06 sarmong

@f-person I have this same problem. The fix is a one line change. I'm willing to submit a pull request if that'd get this fixed sooner!

aarondill avatar Apr 09 '25 06:04 aarondill