# Missing Git in Inbound-agent running on K8s

**URL:** <https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639>\
**Category:** Ask a question\
**Created:** [June 3, 2022, 7:16pm UTC](https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639 "2022-06-03T19:16:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![leosalcie](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@leosalcie](https://community.jenkins.io/u/leosalcie)\
**Post date:** [June 3, 2022, 7:16pm UTC](https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639/1 "2022-06-03T19:16:44Z")

</div>

Hi I’m a newbie,  
Running a Jenkins controller/agent 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/](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’

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [June 3, 2022, 8:34pm UTC](https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639/2 "2022-06-03T20:34:24Z")

</div>

> [@leosalcie](#):
>
> Running a Jenkins controller/agent lab on Kubernetes. K8s and Git plugin installed.

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

> **[Glossary](https://www.jenkins.io/doc/book/glossary/)**
>
> Jenkins – an open source automation server which enables developers around the world to reliably build, test, and deploy their software

> [@leosalcie](#):
>
> but neither of them have Git installed.

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

> [@leosalcie](#):
>
> git fetch --tags --force --progress – /leosalcie/pythonapp.git +refs/heads/:refs/remotes/origin/ # timeout=10  
> ERROR: Error fetching remote repo ‘origin’

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

---

<div class="post-metadata">

**Author:** ![leosalcie](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@leosalcie](https://community.jenkins.io/u/leosalcie)\
**Post date:** [June 3, 2022, 10:15pm UTC](https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639/3 "2022-06-03T22:15:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![leosalcie](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@leosalcie](https://community.jenkins.io/u/leosalcie)\
**Post date:** [June 7, 2022, 5:50pm UTC](https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639/4 "2022-06-07T17:50:16Z")

</div>

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](https://github.com/leosalcie/pythonapp.git)’  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [June 8, 2022, 6:36am UTC](https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639/5 "2022-06-08T06:36:25Z")

</div>

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

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

```

[worked just fine](https://ci.g4v.dev/job/demos/job/leosalcie/1/console) (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.

---

<div class="post-metadata">

**Author:** ![leosalcie](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@leosalcie](https://community.jenkins.io/u/leosalcie)\
**Post date:** [June 8, 2022, 2:28pm UTC](https://community.jenkins.io/t/missing-git-in-inbound-agent-running-on-k8s/2639/6 "2022-06-08T14:28:08Z")

</div>

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

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

```auto
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

```
