diff --git a/Jenkinsfile b/Jenkinsfile index 8bac2cbd00..7d986e1b20 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ buildPlugin(failFast: false, configurations: [ - [platform: 'linux', jdk: 17, jenkins: '2.346.1'], - [platform: 'maven-11', jdk: 11], + [platform: 'linux', jdk: 17, jenkins: '2.361.1'], + [platform: 'maven-11', jdk: 11, jenkins: '2.346.3'], [platform: 'windows', jdk: 8], ]) diff --git a/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java b/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java index 66d537a199..f477ba9f0f 100644 --- a/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java +++ b/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java @@ -946,15 +946,17 @@ public void execute() throws GitException, InterruptedException { /* See JENKINS-45228 */ /* Git merge requires authentication in LFS merges, plugin does not authenticate the git merge command */ - String defaultRemote = null; + String repoUrl = null; try { - defaultRemote = getDefaultRemote(); + String defaultRemote = getDefaultRemote(); + if (defaultRemote != null && !defaultRemote.isEmpty()) { + repoUrl = getRemoteUrl(defaultRemote); + } } catch (GitException e) { - /* Nothing to do, just keeping defaultRemote = null */ + /* Nothing to do, just keeping repoUrl = null */ } - if (defaultRemote != null && !defaultRemote.isEmpty()) { - String repoUrl = getRemoteUrl(defaultRemote); + if (repoUrl != null) { StandardCredentials cred = credentials.get(repoUrl); if (cred == null) cred = defaultCredentials; launchCommandWithCredentials(args, workspace, cred, repoUrl);