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
17,548 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
• 7,340 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,220 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, 2019 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

+1 vote
1 answer

i have a pyhton code in my git/git repository how to build that code in jenkins

Follow these steps @Bhaskar: Step 1: Open the Jenkins ...READ MORE

answered Oct 14, 2019 in DevOps Tools by Kalgi
• 52,350 points
884 views
0 votes
1 answer

How to get the current status of a local repository in Git?

Using 'git status' command in the repository ...READ MORE

answered Nov 26, 2019 in DevOps Tools by Sirajul
• 59,230 points
733 views
+1 vote
1 answer

Not able to browse jenkins from windows browser!

Hi@akhtar, You may get this error because your ...READ MORE

answered May 4, 2020 in DevOps Tools by MD
• 95,460 points
8,895 views
0 votes
1 answer

ERROR: Could not find a valid gem 'logstash-core-plugin-api' (>= 0) in any repository

Hi@akhtar, I think you don't have JRuby installed ...READ MORE

answered Jun 18, 2020 in DevOps Tools by MD
• 95,460 points
2,311 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,039 views
+2 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
34,061 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 17, 2018 in DevOps Tools by shubham
• 7,340 points

edited Jun 17, 2018 by shubham 1,355 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP