This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new 81e6b0e8 Allow repository URI to start with ssh:// to use ports 
different to 22 (#1472)
81e6b0e8 is described below

commit 81e6b0e81821ac2fb3a48297eedd41ca8db05b84
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Thu Jan 16 14:45:22 2025 +0100

    Allow repository URI to start with ssh:// to use ports different to 22 
(#1472)
    
    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.
---
 .../src/main/java/org/apache/camel/karavan/service/GitService.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java 
b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
index 83660f3b..b27bf69b 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
@@ -442,7 +442,7 @@ public class GitService {
     }
 
     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;

Reply via email to