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. 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 # timeout=10
Fetching upstream changes from
 > /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials 
Setting http proxy:
 > /usr/bin/git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from
    at hudson.plugins.git.GitSCM.fetchFrom(
    at hudson.plugins.git.GitSCM.retrieveChanges(
    at hudson.plugins.git.GitSCM.checkout(
    at hudson.scm.SCM.checkout(
    at hudson.model.AbstractProject.checkout(
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
    at jenkins.scm.SCMCheckoutStrategy.checkout(
    at hudson.model.AbstractBuild$
    at hudson.model.Run.execute(
    at hudson.model.ResourceController.execute(
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stderr: error: Failed connect to; Operation now in progress while accessing

Can anyone solve this query?


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

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  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

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

$> git config --global http.proxy\\<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,360 points
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
+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,440 points
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,440 points
+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
+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
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,228 views
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP