not able to connect to the GIT Repository through Git plugin in Jenkins

0 votes

I am trying to pull the code form GIT using GIT Plugin Jenkins and the job is running on a slave machine. http_proxy=mycom.domain.com:80 is assigned to master node.

There is no http_proxy defined for slave node.I  have done git clone locally on the slave node and it worked fine but I am unable to clone git through Jenkins.

It's displaying following error:

Building remotely on SLAVE in workspace /data/test
 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > /usr/bin/git config remote.origin.url https://github.domain.com/Project-Digital/Project-eCommerce.git # timeout=10
Fetching upstream changes from https://github.domain.com/Project-Digital/Project-eCommerce.git
 > /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
Setting http proxy: mycom.domain.com:80
 > /usr/bin/git fetch --tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.domain.com/Project-Digital/Project-eCommerce.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
    at hudson.scm.SCM.checkout(SCM.java:495)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1728)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://github.domain.com/Project-Digital/Project-eCommerce.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: error: Failed connect to github.build.ge.com:80; Operation now in progress while accessing https://github.domain.com/Project-Digital/Project-eCommerce.git/info/refs


Can anyone solve this query?

Thanks

May 1, 2018 in DevOps Tools by Atul
• 10,240 points
3,234 views

3 answers to this question.

0 votes

Turned out it was a proxy issue.

While pulling the code from GIT using Jenkins it was setting the http_proxy to mycom.domain.com:80  and this proxy was not required in the slave node.

So, I have added GIT URL to No Proxy Host section in Jenkins and now it is working fine.

Hope it will help you resolve your query.

answered May 1, 2018 by shubham
• 6,870 points
0 votes
Before pulling the project, try to set the HTTP proxy in global configuration:

$> git config --global http.proxy http://mycom.example.com:80

If you need to provide a username and a password for your proxy, you can use:

$> git config --global http.proxy http://example.com\\<yourUsername>:<yourPassword>@<yourProxyServer>:80
answered Aug 2, 2018 by lina
• 8,100 points
0 votes

One of the possibility is that your Jenkins is not connected to git. To connect them follow these steps:

  • Create a new maven job
  • Check the radio button for git. Enter the uri of your git repository
  • Click on save and apply

answered Apr 22 by Ananya

I have done the exact same thing but I ended up with the following error:

Failed to connect to repository : Command "git ls-remote -h git@example.git HEAD" returned status code 128: stdout: stderr: fatal: 'git@example.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly

What do I do?

You might haven't configured your Jenkins right, use the following steps:

1. Go to to the terminal

2.Run this command : sudo visudo

3. Add %jenkins ALL=NOPASSWD: ALL in this file where sudo privilege is defined.and close the file.

4.login as Jenkins user via command : sudo su jenkins

5. Create a .ssh directory in the jenkins home directory.

Related Questions In DevOps Tools

+4 votes
2 answers

Jenkins not showing Maven Release Plugin

Make your project type Maven Project. This ...READ MORE

answered Oct 11, 2018 in DevOps Tools by Hannah
• 14,080 points
583 views
0 votes
1 answer

how to fix the build with maven in bluemix

As per Bluemix Status Page today DevOps Delivery Pipeline ...READ MORE

answered Jul 6, 2018 in DevOps Tools by Kalgi
• 37,320 points
57 views
0 votes
1 answer

login popup not working in tomcat9 when I click the server status

Try and install tomcat 8.0.41. It is ...READ MORE

answered Jul 12, 2018 in DevOps Tools by DareDev
• 6,810 points
29 views
0 votes
1 answer

Deploy in to jboss EAP 6.4 from jenkins

You can use the mavan plugin <plugin> <groupId>org.jboss.as.plugins</groupId> <artifactId>jboss-as-maven-plugin</artifactId> <version>7.9.Final</version> <configuration> ...READ MORE

answered Jul 20, 2018 in DevOps Tools by Kalgi
• 37,320 points
363 views
+13 votes
2 answers
0 votes
1 answer
+4 votes
4 answers

perform Git checkout using Groovy script

To do git commit: def getGitCommit() { ...READ MORE

answered Dec 6, 2018 in DevOps Tools by Vaidya
5,197 views
0 votes
1 answer

Vagrant provision shell : can not run ssh-copy-id

I think I can help you with ...READ MORE

answered Jun 16, 2018 in DevOps Tools by shubham
• 6,870 points

edited Jun 16, 2018 by shubham 177 views