Skip to content

Commit

Permalink
Allow repository URI to start with ssh:// to use ports different to 22
Browse files Browse the repository at this point in the history
SSH repo URIs can be specified in two ways for jgit. ssh://user@host:port/path and a shorter one git@host:user/repopath.

This fix enables the usage of the former one. That enables the usage of ports different to port 22.

Note: As jgit supports another protocol named "git" directly, we should probably look for "git@" at the start instead of "git", as "git://" starts with "git", but is not an ssh protocol.
  • Loading branch information
FSchumacher authored Jan 16, 2025
1 parent 0f6a662 commit 3f4a7ff
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public boolean checkGit() throws Exception {
}

private <T extends TransportCommand> T setCredentials(T command) {
if (privateKeyPath.isPresent() && repository.startsWith("git")) {
if (privateKeyPath.isPresent() && (repository.startsWith("git") || repository.startsWith("ssh://"))) {
LOGGER.info("Set SshTransport");
command.setTransportConfigCallback(transport -> {
SshTransport sshTransport = (SshTransport) transport;
Expand Down

0 comments on commit 3f4a7ff

Please sign in to comment.