Answers: <p>As far as I can tell, there is no way to tweak arbitrary git config settings from within Jenkins.  You would have to tweak your git config on your build agents.  If you're using permanent agents, this would involve logging in as the jenkins user and running <code>git config --global ...</code>.  If you're using docker build agents, then you would need to bake the git config settings into your image.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-03-04T21:37:42.373Z
Answers: Good one here. I created a Dockerfile extending from the "jenkins" image, ran that command, and it works. From the way the Git plugin expresses themselves in relation to the Author settings, that it just sets some env variables, I was confused whether the global gitconfig would have any effect! Thank you very much.
Answers: Nuno
Answers: CC BY-SA 4.0
Answers: 2021-03-03T20:41:13.877Z
Answers: 2021-03-03T20:41:13.877Z
Answers: jayhendren
Body: <p>I have a self-hosted Gitea organization, and the way to access the repos requires some &quot;secret&quot; <code>extraheader</code> in .gitconfig. (2FA is also enabled)</p>
  <p>When I look at Jenkins &quot;Configure System&quot; settings, under the &quot;Git plugin&quot; section, it seems that the only .gitconfig options I can change through the UI are &quot;user.name&quot; and &quot;user.email&quot;.</p>
  <p>Is there any way I can change extra .gitconfig settings, such as adding <code>http.[url].extraheader</code>, or a way to run <code>git config --global</code> commands, before a <code>git clone</code> or <code>git pull</code> is performed?</p>
  
Tags: <docker><jenkins><jenkins-pipeline><git><jenkins-plugins>
Title: Jenkins Docker - Make changes to gitconfig
UserDisplayName: Nuno
ThreadText: # Jenkins Docker - Make changes to gitconfig
  
  (Asked by: username_0 on 2021-03-02)
  
  I have a self-hosted Gitea organization, and the way to access the repos requires some "secret" `extraheader` in .gitconfig. (2FA is also enabled)
  
  When I look at Jenkins "Configure System" settings, under the "Git plugin" section, it seems that the only .gitconfig options I can change through the UI are "user.name" and "user.email".
  
  Is there any way I can change extra .gitconfig settings, such as adding `http.[url].extraheader`, or a way to run `git config --global` commands, before a `git clone` or `git pull` is performed?
  
  **Tags:** docker, jenkins, jenkins-pipeline, git, jenkins-plugins
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-03. Score: 1 | Accepted answer
  
  As far as I can tell, there is no way to tweak arbitrary git config settings from within Jenkins. You would have to tweak your git config on your build agents. If you're using permanent agents, this would involve logging in as the jenkins user and running `git config --global ...`. If you're using docker build agents, then you would need to bake the git config settings into your image.
  
  > **Comments:**
  > **username_0**: Good one here. I created a Dockerfile extending from the "jenkins" image, ran that command, and it works. From the way the Git plugin expresses themselves in relation to the Author settings, that it just sets some env variables, I was confused whether the global gitconfig would have any effect! Thank you very much.  
  
  ---
  
  