Missing Git in Inbound-agent running on K8s

Hi I’m a newbie,
Running a Jenkins Master/Slave lab on Kubernetes. K8s and Git plugin installed.
I want to clone a Git repo, store it in a shared folder on K8, then Kaniko will use it to build a image.

Already tried to clone it from the Jenkins Agent and even from Kaniko container, but neither of them have Git installed. How am I suppose to do it? Sure I’m missing something… Any idea is appreciated.

Example:

pipeline {
agent any
stages {
stage(‘Clone Git’) {
steps {
git branch: ‘main’, credentialsId: ‘git_credentials’, url: ‘https://github.com//pythonapp.git’
}
}
}
}

Result:
Running on Jenkins in /var/jenkins_home/workspace/CloningGit
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Clone Git)
[Pipeline] git
The recommended git tool is: NONE
using credential git_credentials

git rev-parse --resolve-git-dir /var/jenkins_home/workspace/CloningGit/.git # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url /leosalcie/pythonapp.git # timeout=10
Fetching upstream changes from /leosalcie/pythonapp.git
git --version # timeout=10
git --version # ‘git version 2.30.2’
using GIT_ASKPASS to set credentials Credenciales de Git
git fetch --tags --force --progress – /leosalcie/pythonapp.git +refs/heads/:refs/remotes/origin/ # timeout=10
ERROR: Error fetching remote repo ‘origin’

Slave has been a deprecated term for many years, please use controller and agent instead.

None of what you’ve quoted says it doesn’t have git installed.

This is just saying the repo /leosalcie/pythonapp.git doesn’t exist, i think you want https://github.com/leosalcie/pythonapp instead

Thanks for your replied @halkeye.
Yes, that’s the url. Forum’s policies didn’t permit to add more than 2 URL so I removed it.

Oh I see, so what could be causing the “timeout=10” issue? I’ve been trying to figure it out for a while.

Any suggestion?

Just to clarify this is my current pipeline:

pipeline {
agent any
stages {
stage(‘Clone Git’) {
steps {
git branch: ‘main’, credentialsId: ‘git_credentials’, url: ‘GitHub - leosalcie/pythonapp
}
}
}
}

suggestions for what? you should use triple backticks to format your code for the forums (works on github too, and most markdown setups).

pipeline {
  agent any
  stages {
    stage("Clone Git") {
      steps {
        git branch: "main", credentialsId: "git_credentials", url: "https://github.com/leosalcie/pythonapp"
      }
    }
  }
}

worked just fine (though I removed credentialsId as I don’t have credentials named git_credentials. MAybe your having some sort of proxy or lack of proxy issue.

Thanks @halkeye
You were right, git cloned was completed successfully.

I thought the “timeout=10” msg was an error.

Started by user admin
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/Git clone
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Clone Git)
[Pipeline] git
The recommended git tool is: NONE
using credential git_credentials
Cloning the remote Git repository
Cloning repository https://github.com/leosalcie/pythonapp.git
 > git init /var/jenkins_home/workspace/Git clone # timeout=10
Fetching upstream changes from https://github.com/leosalcie/pythonapp.git
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
using GIT_ASKPASS to set credentials Credencuales de Git
 > git fetch --tags --force --progress -- https://github.com/leosalcie/pythonapp.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url https://github.com/leosalcie/pythonapp.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
 > git rev-parse refs/remotes/origin/main^{commit} # timeout=10
Checking out Revision 0a9821eb250d2f126a667ba3c441e28cb92e300e (refs/remotes/origin/main)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 0a9821eb250d2f126a667ba3c441e28cb92e300e # timeout=10
 > git branch -a -v --no-abbrev # timeout=10
 > git checkout -b main 0a9821eb250d2f126a667ba3c441e28cb92e300e # timeout=10
Commit message: "Update Dockerfile"
First time build. Skipping changelog.
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS