diff --git a/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceBuilder.java b/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceBuilder.java index f0a057ce5..616cbb3c8 100644 --- a/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceBuilder.java +++ b/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceBuilder.java @@ -129,7 +129,7 @@ public GitHubSCMSource build() { GitHubSCMSource result = new GitHubSCMSource(repoOwner, projectName(), credentials); result.setId(id()); result.setApiUri(apiUri()); - result.setCredentialsId(credentialsId()); + result.setCredentialsId(credentials == null ? credentialsId() : credentials.getId()); result.setTraits(traits()); return result; }