Can't generate links if repo contains `git+ssh` remote
wjbuys opened this issue · 2 comments
We have a Github Enterprise server (redacted actual hostname with example.com
) which only supports SSH remotes, so we have a remote like:
[remote "origin"]
url = git+ssh://git@git.example.com/some/repo
fetch = +refs/heads/*:refs/remotes/origin/*
I configured this as a custom host:
But when I try to copy the link, I get this error:
java.net.URISyntaxException: Illegal character in hostname at index 10: http://git+git.example.com/some/repo
at java.base/java.net.URI$Parser.fail(URI.java:2913)
at java.base/java.net.URI$Parser.parseHostname(URI.java:3448)
at java.base/java.net.URI$Parser.parseServer(URI.java:3297)
at java.base/java.net.URI$Parser.parseAuthority(URI.java:3216)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3158)
at java.base/java.net.URI$Parser.parse(URI.java:3114)
at java.base/java.net.URI.<init>(URI.java:685)
at java.base/java.net.URI.<init>(URI.java:786)
at uk.co.ben_gibson.git.link.git.RemoteExtensionsKt.getHttpUrl(RemoteExtensions.kt:43)
at uk.co.ben_gibson.git.link.pipeline.GenerateUrlMiddleware.invoke(GenerateUrlMiddleware.kt:24)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:11)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.TimerMiddleware.invoke(TimerMiddleware.kt:23)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:11)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.ForceHttpsMiddleware.invoke(ForceHttpsMiddleware.kt:14)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:11)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.RecordHitMiddleware.invoke(RecordHitMiddleware.kt:13)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:11)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.HostPollMiddleware.invoke(HostPollMiddleware.kt:15)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:11)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.RatePluginMiddleware.invoke(RatePluginMiddleware.kt:15)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.access$next(Pipeline.kt:11)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:37)
at uk.co.ben_gibson.git.link.pipeline.Pipeline$next$1.invoke(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.ResolveContextMiddleware.invoke(ResolveContextMiddleware.kt:27)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.next(Pipeline.kt:36)
at uk.co.ben_gibson.git.link.pipeline.Pipeline.accept(Pipeline.kt:30)
at uk.co.ben_gibson.git.link.GitLinkRunnerKt$processGitLink$$inlined$runBackgroundableTask$1.run(progress.kt:38)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:176)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
You can use the GitHub
host type rather than a custom one. Host
isn't really a good name for the option in the settings as it's mostly about the URL format i.e. using the host GitHub
will work with Github Enterprise server
.
The protocol of the remote url you posted, git+ssh://git@git.example.com/some/repo
, doesn't look quite right though, shouldn't it be ssh://git@git.example.com/some/repo
?
Hm, that's odd, I've re-cloned that repo with a more recent git client, and I get a more normal remote url:
[remote "origin"]
url = git@git.example.com/some/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
I think that git+ssh
url was a quirk of an older ssh bastion setup or something. Changing to use the new remote without the +
fixes it for me.
Thanks for the help!