Jenkins Jobs are getting failed with Git Error

Resume disabled by user, switching to high-performance, low-durability mode.
Loading library jenkins-shared-function@main
Library jenkins-shared-function@main is cached. Copying from cache.
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins Agent1 in /home/hcluser/ /home/hcluser/ /home/hcluser/workspace/BusinessIT-Builds/mhs-apitokens-lambda-inlinehook
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential github-businessitcicd
Wiping out workspace first.
Cloning the remote Git repository
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /home/hcluser/ /home/hcluser/ /home/hcluser/workspace/BusinessIT-Builds/mhs-apitokens-lambda-inlinehook
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1073)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:819)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:170)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
	at hudson.remoting.UserRequest.perform(UserRequest.java:225)
	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
	at hudson.remoting.Request$2.run(Request.java:391)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:81)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to Jenkins Agent1
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1923)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:384)
		at hudson.remoting.Channel.call(Channel.java:1112)
		at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:153)
		at jdk.internal.reflect.GeneratedMethodAccessor810.invoke(Unknown Source)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:569)
		at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:138)
		at PluginClassLoader for git-client/jdk.proxy66/jdk.proxy66.$Proxy153.execute(Unknown Source)
		at PluginClassLoader for git//hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1220)
		at PluginClassLoader for git//hudson.plugins.git.GitSCM._checkout(GitSCM.java:1310)
		at PluginClassLoader for git//hudson.plugins.git.GitSCM.checkout(GitSCM.java:1277)
		at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
		at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
		at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
		at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
		... 4 more
Caused by: hudson.plugins.git.GitException: Error performing git command: /usr/bin/git init /home/hcluser/ /home/hcluser/ /home/hcluser/workspace/BusinessIT-Builds/mhs-apitokens-lambda-inlinehook
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2862)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2766)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2761)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1071)
	... 11 more
Caused by: java.io.IOException: Cannot run program "/usr/bin/git" (in directory "/home/hcluser/ /home/hcluser/ /home/hcluser/workspace/BusinessIT-Builds/mhs-apitokens-lambda-inlinehook"): error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
	at Jenkins v2.479.3//hudson.Proc$LocalProc.<init>(Proc.java:252)
	at Jenkins v2.479.3//hudson.Proc$LocalProc.<init>(Proc.java:221)
	at Jenkins v2.479.3//hudson.Launcher$LocalLauncher.launch(Launcher.java:994)
	at Jenkins v2.479.3//hudson.Launcher$ProcStarter.start(Launcher.java:506)
	at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2839)
	... 15 more
Caused by: java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
	... 21 more
ERROR: Error cloning remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE
======================================================================

Jenkins setup:

Jenkins: 2.479.3
OS: Linux - 4.18.0-348.7.1.el8_5.x86_64
Java: 17.0.15 - Red Hat, Inc. (OpenJDK 64-Bit Server VM)
---
Office-365-Connector:5.0.0
ace-editor:1.1
amazon-ecr:1.151.vb_ca_71ddd0b_cf
ant:511.v0a_a_1a_334f41b_
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
apache-httpcomponents-client-5-api:5.4-136.v5a_21779c63f8
appscan:1.5.1
asm-api:9.7.1-97.v4cc844130d97
authentication-tokens:1.119.v50285141b_7e1
aws-credentials:243.v41c19a_fb_5dcf
aws-java-sdk:1.12.772-477.v650d756dcf6d
aws-java-sdk-api-gateway:1.12.772-477.v650d756dcf6d
aws-java-sdk-autoscaling:1.12.772-477.v650d756dcf6d
aws-java-sdk-cloudformation:1.12.772-477.v650d756dcf6d
aws-java-sdk-cloudfront:1.12.772-477.v650d756dcf6d
aws-java-sdk-cloudwatch:1.12.772-477.v650d756dcf6d
aws-java-sdk-codebuild:1.12.772-477.v650d756dcf6d
aws-java-sdk-codedeploy:1.12.772-477.v650d756dcf6d
aws-java-sdk-ec2:1.12.772-477.v650d756dcf6d
aws-java-sdk-ecr:1.12.772-477.v650d756dcf6d
aws-java-sdk-ecs:1.12.772-477.v650d756dcf6d
aws-java-sdk-efs:1.12.772-477.v650d756dcf6d
aws-java-sdk-elasticbeanstalk:1.12.772-477.v650d756dcf6d
aws-java-sdk-elasticloadbalancingv2:1.12.772-477.v650d756dcf6d
aws-java-sdk-iam:1.12.772-477.v650d756dcf6d
aws-java-sdk-kinesis:1.12.772-477.v650d756dcf6d
aws-java-sdk-lambda:1.12.772-477.v650d756dcf6d
aws-java-sdk-logs:1.12.772-477.v650d756dcf6d
aws-java-sdk-minimal:1.12.772-477.v650d756dcf6d
aws-java-sdk-organizations:1.12.772-477.v650d756dcf6d
aws-java-sdk-secretsmanager:1.12.772-477.v650d756dcf6d
aws-java-sdk-sns:1.12.772-477.v650d756dcf6d
aws-java-sdk-sqs:1.12.772-477.v650d756dcf6d
aws-java-sdk-ssm:1.12.772-477.v650d756dcf6d
aws-java-sdk2-core:2.30.10-22.v1339d66b_e0f4
aws-java-sdk2-ec2:2.30.10-22.v1339d66b_e0f4
aws-java-sdk2-ecr:2.30.10-22.v1339d66b_e0f4
blueocean:1.27.16
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.16
blueocean-commons:1.27.16
blueocean-config:1.27.16
blueocean-core-js:1.27.16
blueocean-dashboard:1.27.16
blueocean-display-url:2.4.3
blueocean-events:1.27.16
blueocean-git-pipeline:1.27.16
blueocean-github-pipeline:1.27.16
blueocean-i18n:1.27.16
blueocean-jwt:1.27.16
blueocean-personalization:1.27.16
blueocean-pipeline-api-impl:1.27.16
blueocean-pipeline-editor:1.27.16
blueocean-pipeline-scm-api:1.27.16
blueocean-rest:1.27.16
blueocean-rest-impl:1.27.16
blueocean-web:1.27.16
bootstrap4-api:4.6.0-6
bootstrap5-api:5.3.3-1
bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_
branch-api:2.1206.vd9f35001c95c
build-timeout:1.33
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.2.2
cloud-stats:336.v788e4055508b_
cloudbees-bitbucket-branch-source:895.v15dc41668f03
cloudbees-folder:6.928.v7c780211d66e
cobertura:1.17
code-coverage-api:4.99.0
command-launcher:116.vd85919c54a_d6
commons-compress-api:1.26.1-2
commons-httpclient3-api:3.1-3
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.13.0-150.vfc0d7966fc38
config-file-provider:980.v88956a_a_5d6a_d
copyartifact:761.vea_2b_25523e84
coverage:1.16.1
credentials:1380.va_435002fa_924
credentials-binding:681.vf91669a_32e45
data-tables-api:2.1.8-1
display-url-api:2.204.vf6fddd8a_8b_e9
docker-commons:445.v6b_646c962a_94
docker-java-api:3.4.1-96.v77147a_de67f8
docker-plugin:1.7.0
docker-workflow:592.v1001d948426c
durable-task:581.v299a_5609d767
echarts-api:5.5.1-4
eddsa-api:0.3.0-4.v84c6f0f4969e
email-ext:1844.v3ea_a_b_842374a_
favorite:2.221.v19ca_666b_62f5
file-operations:266.v9d4e1eb_235b_a_
font-awesome-api:6.6.0-2
forensics-api:2.7.0
git:5.5.2
git-client:5.0.2
git-server:126.v0d945d8d2b_39
github:1.40.0
github-api:1.321-468.v6a_9f5f2d5a_7e
github-branch-source:1807.v50351eb_7dd13
gradle:2.14
gson-api:2.11.0-85.v1f4e87273c33
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
htmlpublisher:1.37
instance-identity:201.vd2a_b_5a_468a_a_6
ionicons-api:74.v93d5eb_813d5f
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javadoc:280.v050b_5c849f69
javax-activation-api:1.2.0-7
javax-mail-api:1.6.2-10
jaxb:2.3.9-1
jdk-tool:80.v8a_dee33ed6f0
jenkins-design-language:1.27.16
jjwt-api:0.11.5-112.ve82dfb_224b_a_d
joda-time-api:2.13.0-93.v9934da_29b_a_e9
jquery3-api:3.7.1-2
jsch:0.2.16-86.v42e010d9484b_
json-api:20241224-119.va_dca_a_b_ea_7da_5
json-path-api:2.9.0-118.v7f23ed82a_8b_8
junit:1312.v1a_235a_b_94a_31
ldap:725.v3cb_b_711b_1a_ef
lockable-resources:1327.ved786b_a_197e0
login-theme:146.v64a_da_cf70ea_6
mailer:488.v0c9639c1a_eb_3
matrix-auth:3.2.3
matrix-project:839.vff91cd7e3a_b_2
maven-plugin:3.24
mina-sshd-api-common:2.14.0-143.v2b_362fc39576
mina-sshd-api-core:2.14.0-143.v2b_362fc39576
miniorange-saml-sp:2.4.5
momentjs:1.1.1
nodejs:1.6.2
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
pam-auth:1.11
people-view:1.2
pipeline-aws:1.45
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-github-lib:61.v629f2cc41d83
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-groovy-lib:749.v70084559234a_
pipeline-input-step:508.v584c0e9a_2177
pipeline-milestone-step:119.vdfdc43fc3b_9a_
pipeline-model-api:2.2218.v56d0cda_37c72
pipeline-model-definition:2.2218.v56d0cda_37c72
pipeline-model-extensions:2.2218.v56d0cda_37c72
pipeline-rest-api:2.34
pipeline-stage-step:312.v8cd10304c27a_
pipeline-stage-tags-metadata:2.2218.v56d0cda_37c72
pipeline-stage-view:2.34
plain-credentials:183.va_de8f1dd5a_2b_
plugin-util-api:4.1.0
popper-api:1.16.1-3
popper2-api:2.11.6-5
prism-api:1.29.0-18
pubsub-light:1.18
resource-disposer:0.24
role-strategy:743.v142ea_b_d5f1d3
s3:483.vcb_db_3dcee68f
saml:4.464.vea_cb_75d7f5e0
scm-api:696.v778d637b_a_762
script-security:1369.v9b_98a_4e95b_2d
snakeyaml-api:2.3-123.v13484c65210a_
sse-gateway:1.27
ssh-credentials:349.vb_8b_6b_9709f5b_
ssh-slaves:2.973.v0fa_8c0dea_f9f
sshd:3.330.vc866a_8389b_58
structs:338.v848422169819
terraform:1.0.10
timestamper:1.27
token-macro:400.v35420b_922dcb_
trilead-api:2.147.vb_73cc728a_32e
variant:60.v7290fc0eb_b_cd
workflow-aggregator:600.vb_57cdd26fdd7
workflow-api:1358.vfb_5780da_64cb_
workflow-basic-steps:1058.vcb_fc1e3a_21a_9
workflow-cps:4009.v0089238351a_9
workflow-cps-global-lib:612.v55f2f80781ef
workflow-durable-task-step:1378.v6a_3e903058a_3
workflow-job:1400.v7fd111b_ec82f
workflow-multibranch:783.787.v50539468395f
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:678.v3ee58b_469476
workflow-support:943.v8b_0d01a_7b_a_08
ws-cleanup:0.47

While running Jenkins jobs we are getting below error, we’ve git installed in Jenkins controller and agent

Please provide the error message that appeared after the text in your screenshot. That is the crucial information.

Please place the text of the message in your posting instead of a screenshot of the message. It is much easier for others to reply to subsets of text blocks that to subsets of screenshots. It is much easier for search engines to index text blocks than screenshots of text blocks.

Ok, I’ve added the details in posting, please check

Command line git is not installed at /usr/bin/git on the agent. Since command line git is not installed, it cannot be run by the Jenkins agent. Install command line git on the agent.

Git was already installed on my Jenkins agent, and the issue began yesterday.
Today, I tried disconnecting and reconnecting the agent, which helped resolve the problem.

But, unable to understand the Root cause here

Root cause is likely an issue on the agent. The “No such file or directory” message from the Jenkins agent indicates that the Jenkins agent Java process cannot find the file /usr/bin/git. Since it cannot find that file, it cannot run it.

There are many possible reasons that the Jenkins agent Java process cannot find that file. It could have been deleted (hopefully you are not running your agent as a user with elevated permissions, but if you are, then something could have removed that file). Permissions of its parent directory could have been changed so that the Jenkins agent Java process can no longer see the file. File system corruption could have caused the /usr/bin/git file to disappear.

What is suspicious is this line in the logs

Running on Jenkins Agent1 in /home/hcluser/ /home/hcluser/ /home/hcluser/workspace/BusinessIT-Builds/mhs-apitokens-lambda-inlinehook

I would have expected

Running on Jenkins Agent1 in /home/hcluser/workspace/BusinessIT-Builds/mhs-apitokens-lambda-inlinehook

The exception could also be thrown when the directory in which to execute git doesn’t exist