0

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?

0

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.

1
  • 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. – Nuno Mar 4 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.