Git, square brackets in URL Follow
Answered
Hi,
We are using TeamCity Professional 2020.1.4 (build 78906). It's impossible to create git root repository using URL with square brackets (specifying port for scp-like URLs), for example:
[git.example.com:1234]:/repo.git
generates exception:
List remote refs failed: com.jcraft.jsch.JSchException: java.net.UnknownHostException: [git.example.com
It's more of an issue with submodules, where submodule URL contains square brackets. It can be fixed by using ssh protocol for URLs, but git cli itself supports square brackets without issues.
Thanks,
Dmitri
Please sign in to leave a comment.
Hi Dmitri,
Thanks for your report, but I've not seen this type of URLs used before. Is there any specific reason you need to use the brackets? URLs should accept using ports without the need for brackets anyway, am I missing something?
If you would need this feature, please feel free to open a feature request in our tracker: https://youtrack.jetbrains.com/issues/TW . Please detail the use case as to why you use bracketed URLs instead of regular ones.
Hi Denis,
Yep, thanks, I'll create a ticket.
It's more of an issue for submodules. We've got multiple git repositories with a lot of submodules where path is set in "scp-like" style (those colons between address and path), which works fine with git itself. For example:
[submodule "Foo"]
path = foo
url = foo.example.com:/foo
[submodule "Bar"]
path = bar
url = [bar.example.com:1234]:bar
It can be easily fixed converting "scp-like" style to the full ssh URL:
[submodule "Bar"]
path = bar
url = ssh://bar.example.com:1234/~/bar
We are using scp-like syntax cause it's slightly shorter and it's the "default" style for clone or add module commands.
Cheers,
Dmitri