Bitbucket connection fails after upgrade from 2.263.1 to 2.387.1

After upgrading Jenkins version from 2.263.1 to 2.387.1 getting the below error from Job configuration for Bitbucket primary server.

Failed to connect to repository : Command “git ls-remote -h ssh://git@XXXXXXXX.com:7999/pts/coverity.git HEAD” returned status code 128:
stdout:
stderr: ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Getting above error when trying to configure Bitbucket primary server (with ssh url). But with Bitbucket mirror is able to connect with ssh url

disk-usage plugin (disk-usage): 0.28
Job Configuration History Plugin (jobConfigHistory): 1207.vd28a_54732f92
Gradle Plugin (gradle): 2.5
Git plugin (git): 5.0.0
Least Load plugin (leastload): 3.0.0
Authentication Tokens API Plugin (authentication-tokens): 1.53.v1c90fd9191a_b_
Favorite (favorite): 2.4.1
Variant Plugin (variant): 59.vf075fe829ccb
Bitbucket Pipeline for Blue Ocean (blueocean-bitbucket-pipeline): 1.27.3
Web for Blue Ocean (blueocean-web): 1.27.3
Pipeline: SCM Step (workflow-scm-step): 408.v7d5b_135a_b_d49
Common API for Blue Ocean (blueocean-commons): 1.27.3
Pipeline: Model API (pipeline-model-api): 2.2125.vddb_a_44a_d605e
MSBuild Plugin (msbuild): 1.30
Events API for Blue Ocean (blueocean-events): 1.27.3
GitHub Pipeline for Blue Ocean (blueocean-github-pipeline): 1.27.3
Git Pipeline for Blue Ocean (blueocean-git-pipeline): 1.27.3
Blue Ocean (blueocean): 1.27.3
JWT for Blue Ocean (blueocean-jwt): 1.27.3
JIRA Integration for Blue Ocean (blueocean-jira): 1.27.3
JUnit Plugin (junit): 1196.vb_4cf28b_c7724
Pipeline implementation for Blue Ocean (blueocean-pipeline-api-impl): 1.27.3
Blue Ocean Pipeline Editor (blueocean-pipeline-editor): 1.27.3
i18n for Blue Ocean (blueocean-i18n): 1.27.3
Blue Ocean Core JS (blueocean-core-js): 1.27.3
Dashboard for Blue Ocean (blueocean-dashboard): 1.27.3
Config API for Blue Ocean (blueocean-config): 1.27.3
JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1
ECharts API Plugin (echarts-api): 5.4.0-3
Branch API Plugin (branch-api): 2.1071.v1a_188a_562481
Pipeline: API (workflow-api): 1208.v0cc7c6e0da_9e
Autofavorite for Blue Ocean (blueocean-autofavorite): 1.2.5
JQuery3 API Plugin (jquery3-api): 3.6.4-1
Translation Assistance plugin (translation): 1.16
Clone Workspace SCM Plug-in (clone-workspace-scm): 84.v147686859e1c
SSH plugin (ssh): 2.6.1
Bootstrap 4 API Plugin (bootstrap4-api): 4.6.0-5
Ionicons API (ionicons-api): 45.vf54fca_5d2154
JAXB plugin (jaxb): 2.3.8-1
bouncycastle API Plugin (bouncycastle-api): 2.27
JaCoCo plugin (jacoco): 3.3.3
SSH Build Agents plugin (ssh-slaves): 2.877.v365f5eb_a_b_eec
Git Parameter Plug-In (git-parameter): 0.9.18
JSch dependency plugin (jsch): 0.1.55.61.va_e9ee26616e7
Environment Injector Plugin (envinject): 2.901.v0038b_6471582
EnvInject API Plugin (envinject-api): 1.199.v3ce31253ed13
Structs Plugin (structs): 324.va_f5d6774f3a_d
PAM Authentication plugin (pam-auth): 1.10
Mailer Plugin (mailer): 448.v5b_97805e3767
Popper.js API Plugin (popper-api): 1.16.1-3
Email Extension Plugin (email-ext): 2.96
Jackson 2 API Plugin (jackson2-api): 2.14.2-319.v37853346a_229
SCM API Plugin (scm-api): 631.v9143df5b_e4a_a
Python Plugin (python): 1.3
SSH server (sshd): 3.275.v9e17c10f2571
Pipeline: Groovy (workflow-cps): 3659.v582dc37621d8
Plot plugin (plot): 2.1.12
TICS Plugin (tics): 2022.4.0.2
Dashboard View (dashboard-view): 2.472.v9ff2a_e6a_c529
Plugin Utilities API Plugin (plugin-util-api): 3.2.0
Checks API plugin (checks-api): 2.0.0
Caffeine API Plugin (caffeine-api): 2.9.3-65.v6a_47d0f4d1fe
Folders Plugin (cloudbees-folder): 6.815.v0dd5a_cb_40e0e
Ant Plugin (ant): 487.vd79d090d4ea_e
Javadoc Plugin (javadoc): 233.vdc1a_ec702cff
Bootstrap 5 API Plugin (bootstrap5-api): 5.2.2-2
Claim Plugin (claim): 516.v36293563731d
GitHub API Plugin (github-api): 1.303-417.ve35d9dd78549
Docker Commons Plugin (docker-commons): 419.v8e3cd84ef49c
GitHub Branch Source Plugin (github-branch-source): 1703.vd5a_2b_29c6cdc
GitHub plugin (github): 1.37.0
TestLink Plugin (testlink): 3.16
Popper.js 2 API Plugin (popper2-api): 2.11.6-2
NUnit plugin (nunit): 0.28
Pub-Sub "light" Bus (pubsub-light): 1.17
Join plugin (join): 1.21
Multiple SCMs plugin (multiple-scms): 0.8
Credentials Binding Plugin (credentials-binding): 604.vb_64480b_c56ca_
Command Agent Launcher Plugin (command-launcher): 90.v669d7ccb_7c31
Ivy Plugin (ivy): 2.4
Workspace Cleanup Plugin (ws-cleanup): 0.45
Pipeline: Build Step (pipeline-build-step): 488.v8993df156e8d
Doxygen (doxygen): 178.v6ea_ef5f7dfdb
Copy Artifact Plugin (copyartifact): 698.v393f578eb_ddc
Jakarta Mail API (jakarta-mail-api): 2.0.1-3
Pipeline: Basic Steps (workflow-basic-steps): 1010.vf7a_b_98e847c1
JavaMail API (javax-mail-api): 1.6.2-9
Jakarta Activation API (jakarta-activation-api): 2.0.1-3
LDAP Plugin (ldap): 673.v034ec70ec2b_b_
Pipeline: Multibranch (workflow-multibranch): 733.v109046189126
REST API for Blue Ocean (blueocean-rest): 1.27.3
OWASP Markup Formatter Plugin (antisamy-markup-formatter): 159.v25b_c67cd35fb_
jQuery plugin (jquery): 1.12.4-1
Font Awesome API Plugin (font-awesome-api): 6.3.0-2
SCons plugin (scons): 0.4
Post build task (postbuild-task): 1.9
Git client plugin (git-client): 4.2.0
Run Condition Plugin (run-condition): 1.5
Lockable Resources plugin (lockable-resources): 1141.v7c5f8f31d2ee
Oracle Java SE Development Kit Installer Plugin (jdk-tool): 66.vd8fa_64ee91b_d
Jira plugin (jira): 3.9
Git server Plugin (git-server): 99.va_0826a_b_cdfa_d
Display URL API (display-url-api): 2.3.7
Config File Provider Plugin (config-file-provider): 3.11.1
Build Timeout (build-timeout): 1.30
Timestamper (timestamper): 1.24
Maven Integration plugin (maven-plugin): 3.21
Trilead API Plugin (trilead-api): 2.84.v72119de229b_7
Docker Pipeline (docker-workflow): 563.vd5d2e5c4007f
Matrix Authorization Strategy Plugin (matrix-auth): 3.1.7
Port Allocator Plug-in (port-allocator): 1.10
Pipeline: Stage Step (pipeline-stage-step): 305.ve96d0205c1c6
Design Language (jenkins-design-language): 1.27.3
Personalization for Blue Ocean (blueocean-personalization): 1.27.3
Script Security Plugin (script-security): 1244.ve463715a_f89c
Pipeline: Declarative Extension Points API (pipeline-model-extensions): 2.2125.vddb_a_44a_d605e
Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 2.2125.vddb_a_44a_d605e
Pipeline: Declarative (pipeline-model-definition): 2.2125.vddb_a_44a_d605e
Resource Disposer Plugin (resource-disposer): 0.22
Pipeline: Job (workflow-job): 1289.vd1c337fd5354
Credentials Plugin (credentials): 1224.vc23ca_a_9a_2cb_0
REST Implementation for Blue Ocean (blueocean-rest-impl): 1.27.3
Artifactory Plugin (artifactory): 3.18.1
Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 202.va_d268e64deb_3
JavaBeans Activation Framework (JAF) API (javax-activation-api): 1.2.0-6
Durable Task Plugin (durable-task): 504.vb10d1ae5ba2f
Pipeline: REST API Plugin (pipeline-rest-api): 2.32
Subversion Plug-in (subversion): 2.17.1
Pipeline: Stage View Plugin (pipeline-stage-view): 2.32
Pipeline (workflow-aggregator): 596.v8c21c963d92d
Monitoring (monitoring): 1.94.0
commons-text API Plugin (commons-text-api): 1.10.0-36.vc008c8fcda_7b_
Plain Credentials Plugin (plain-credentials): 143.v1b_df8b_d3b_e48
Pipeline: Nodes and Processes (workflow-durable-task-step): 1244.vee71f675dee6
Warnings Next Generation Plugin (warnings-ng): 10.1.0
SnakeYAML API Plugin (snakeyaml-api): 1.33-95.va_b_a_e3e47b_fa_4
Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 42.v0739460cda_c4
Build Monitor View (build-monitor-plugin): 1.14-681.vd6817317a_2b_7
Pipeline SCM API for Blue Ocean (blueocean-pipeline-scm-api): 1.27.3
Bitbucket Branch Source Plugin (cloudbees-bitbucket-branch-source): 800.va_b_b_9a_a_5035c1
JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 3.0.8
Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.14-150.v7a_b_9d17134a_5
Drop Down ViewsTabBar Plugin (dropdown-viewstabbar-plugin): 1.7
Shared Workspace (shared-workspace): 1.0.2
Icon Shim (icon-shim): 3.0.0
Groovy Label Assignment plugin (groovy-label-assignment): 1.2.0
Radiator View Plugin (radiatorviewplugin): 1.29
Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1
Build Pipeline Plugin (build-pipeline-plugin): 1.5.8
Build Token Trigger Plugin (build-token-trigger): 1.0.0
Bitbucket Build Status Notifier Plugin (bitbucket-build-status-notifier): 1.4.2
Display URL for Blue Ocean (blueocean-display-url): 2.4.1
Nuget Plugin (nuget): 1.1
Build Blocker Plugin (build-blocker-plugin): 1.7.8
Conditional BuildStep (conditional-buildstep): 1.4.2
Handy Uri Templates 2.x API Plugin (handy-uri-templates-2-api): 2.1.8-22.v77d5b_75e6953
Parameterized Trigger plugin (parameterized-trigger): 2.45
Matrix Project Plugin (matrix-project): 789.v57a_725b_63c79
Pipeline: Step API (workflow-step-api): 639.v6eca_cd8c04a_a_
MapDB API Plugin (mapdb-api): 1.0.9-28.vf251ce40855d
commons-lang3 v3.x Jenkins API Plugin (commons-lang3-api): 3.12.0-36.vd97de6465d5b_
Server Sent Events (SSE) Gateway Plugin (sse-gateway): 1.26
SSH Credentials Plugin (ssh-credentials): 305.v8f4381501156
promoted builds plugin (promoted-builds): 892.vd6219fc0a_efb
HTML Publisher plugin (htmlpublisher): 1.31
External Monitor Job Type Plugin (external-monitor-job): 203.v683c09d993b_9
Mercurial plugin (mercurial): 1260.vdfb_723cdcc81
Pipeline: Supporting APIs (workflow-support): 839.v35e2736cfd5c
Log Parser Plugin (log-parser): 2.3.0
Naginator (naginator): 1.18.2
Pipeline: Deprecated Groovy Libraries (workflow-cps-global-lib): 609.vd95673f149b_b
Mina SSHD API :: Common (mina-sshd-api-common): 2.9.2-62.v199162f0a_2f8
Mina SSHD API :: Core (mina-sshd-api-core): 2.9.2-62.v199162f0a_2f8
Token Macro Plugin (token-macro): 359.vb_cde11682e0c
Pipeline: Input Step (pipeline-input-step): 466.v6d0a_5df34f81
Instance Identity (instance-identity): 142.v04572ca_5b_265
Discard Old Build plugin (discard-old-build): 1.07
Pipeline: Milestone Step (pipeline-milestone-step): 111.v449306f708b_7
JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1
JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1
OkHttp Plugin (okhttp-api): 4.10.0-132.v7a_7b_91cef39c
Pipeline: Groovy Libraries (pipeline-groovy-lib): 656.va_a_ceeb_6ffb_f7
DataTables.net API Plugin (data-tables-api): 1.13.3-3
Forensics API Plugin (forensics-api): 2.1.0
Prism API Plugin (prism-api): 1.29.0-4
Java JSON Web Token (JJWT) Plugin (jjwt-api): 0.11.5-77.v646c772fddb_0
Active Directory plugin (active-directory): 2.30
Analysis Model API Plugin (analysis-model-api): 11.1.0
Jersey 2 API (jersey2-api): 2.39.1-1
Multi-Branch Project Plugin (DEPRECATED) (multi-branch-project-plugin): 0.7
Violations plugin (violations): 0.7.11
WMI Windows Agents Plugin (windows-slaves): 1.8.1
Commons HttpClient 3.x API (commons-httpclient3-api): 3.1-3
Office 365 Connector (Office-365-Connector): 4.18.0
Extended Choice Parameter Plugin (extended-choice-parameter): 359.v35dcfdd0c20d
Active Choices Plug-in (uno-choice): 2.6.5
Extensible Choice Parameter plugin (extensible-choice-parameter): 1.8.0
Build With Parameters (build-with-parameters): 76.v9382db_f78962
Simple Theme Plugin (simple-theme-plugin): 146.v0e67db_a_9052e
SSH Agent Plugin (ssh-agent): 327.v230ecd01f86f

A CloudBees knowledgebase article recommends:

add a parameter or a environment variable named GIT_SSH_COMMAND with value “ssh -vvv” this will tell GIT to show all messages about connection.

The diagnostic output from the ssh command may help you identify the difference between the successful git server and the unsuccessful git server.

Hi Mark, Thanks for the reply.

Enabled “GIT_SSH_COMMAND ssh -vvv” on Jenkins global level configuration. Triggered the build. I can see GIT_SSH_COMMAND
ssh -vvv under Jenkins job environment variables. Output is as below.

ssh://git@XXXXXXXXXXXXXX:7999/pts/coverity.git +refs/heads/:refs/remotes/origin/" returned status code 128:
stdout:
stderr: ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2732)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2109)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:623)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:850)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1226)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1309)
at hudson.scm.SCM.checkout(SCM.java:540)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1240)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521)
at hudson.model.Run.execute(Run.java:1900)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)

ERROR: Error cloning remote repo ‘origin’
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Notifying upstream projects of job completion
Finished: FAILURE

Check that you exactly followed the instructions in that article. The most recent output you provided contains no additional information.

@MarkEWaite,

Apologies for delay in response.

We have set the Variables, but log is not displaying the same error.

Please find the attached logs

.

git fetch --tags --progress ssh://:7999/pts/coverity.git +refs/heads/:refs/remotes/origin/ # timeout=10
ERROR: Error cloning remote repo ‘origin’
hudson.plugins.git.GitException: Command “git fetch --tags --progress ssh://:7999/pts/coverity.git +refs/heads/:refs/remotes/origin/” returned status code 128:
stdout:
stderr: ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2732)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2109)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:623)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:850)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1226)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1309)
at hudson.scm.SCM.checkout(SCM.java:540)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1240)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521)
at hudson.model.Run.execute(Run.java:1900)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)

ERROR: Error cloning remote repo ‘origin’
$ ssh-agent -k
unset SSH_AUTH_SOCK;
unset SSH_AGENT_PID;
echo Agent pid 10887 killed;
[ssh-agent] Stopped.

Replaced “ssh -vvv” to ssh -vvv

@MarkEWaite,

Please let me know if I need to share anymore information.

Unfortunately, the additional information you provided still does not show any additional diagnostic data. Either you did not follow the instructions completely or the instructions are no longer correct.

Hi Mark,

Removed “/var/lib/jenkins/.ssh/config”, post that error disappeared. Now we are able to clone from Primary Bitbucket server. Request you to close the ticket.

1 Like

We can’t close, and it’s not a ticket, but thanks a lot for letting us know you solved your issue, and sharing your solution with the community. :+1: