Kiran
Kiran

Reputation: 159

How to configure proxy in Jenkins to access Git Repository?

I am trying to configure Jenkins to checkout a branch from github and build. Locally I need to configure proxy to access github, so I executed the following and I am able to successfully access github and checkout.

git config --global http.proxy http://proxy.com:8080
git config --global https.proxy https://proxy.com:8080

I don't know how to replicate these proxy setting for Jenkins user. Jenkins runs as Windows service so it does not access .gitconfig from my profile and hence Jenkins job is erroring out. Help please!

EDIT I created a dummy job in Jenkins and configured proxy settings within the "Execute Windows batch command". I configured them with --global so it works for other builds.

Upvotes: 1

Views: 21332

Answers (4)

Sudeep Singh Thakur
Sudeep Singh Thakur

Reputation: 99

you can pass settings.xml please see attached image for jenkins.

<settings>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>http-host.url.com</host>
<port>8080</port>
<username>userid</username>
<password>*******</password>
<nonProxyHosts>*.abc.xyz.com</nonProxyHosts>
</proxy>
</proxies>
</settings>

enter image description here

Upvotes: 0

themenace
themenace

Reputation: 2800

You can configure the proxy server that Jenkins will use by going to

Manage Jenkins > Manage Plugins > Advanced

The Git Plugin supports a proxy server

see: https://wiki.jenkins.io/display/JENKINS/JenkinsBehindProxy

Upvotes: 4

Kiran
Kiran

Reputation: 159

I created a dummy job in Jenkins and configured proxy settings within the "Execute Windows batch command". I configured them with --global so it works for other builds.

Upvotes: 2

Andrew Gray
Andrew Gray

Reputation: 3661

If you are able to log onto the server that is running the Jenkins windows service as the user that the windows service is running under, you would be able to set git global proxy settings for that user the same as you did for yourself.

Upvotes: 0

Related Questions