Failed to connect to repository Error performing git command git ls-remote -https github com jenikis hook git HEAD

Hello Everyone, we are back with one more DevOps article. Today, in this article we will discuss a scenario where while configuring a GitHub repo in Jenkins, we get the following error – Failed To Connect To Repository Error Performing Git Command Git Ls-Remote -Https Github Com Jenikis Hook Git HEAD.

error screenshot

When I was configuring for the first time, I also had the same error. It took me 2 days to finally figure out the solution for this. But you guys won’t have to wait this long. Let’s just dive into the solution very quickly:

The reason that we are getting this error is, that the machine where Jenkins is running could not able to find the git commands to clone the repository. yes, you got it! You need to install the git in the Jenkins server or your default agent node. Please follow the below steps to install the git on your Jenkins server or agent:

Debian/Ubuntu

# apt-get install git

Fedora

# sudo yum install git

Gentoo

# emerge --ask --verbose dev-vcs/git

Arch Linux

# pacman -S git

openSUSE

# zypper install git

Mageia

# urpmi git

Nix/NixOS

# nix-env -i git

FreeBSD

# pkg install git

Solaris 9/10/11

# pkgutil -i git

OpenBSD

# pkg_add git

Alpine

$ apk add git

Windows (PowerShell Method)

winget install --id Git.Git -e --source winget

MacOS

$ brew install git

After installing git, just restart your Jenkins service and refresh the Jenkins homepage in the browser. Now try to configure/add the repo again, this time you will be able to install it without any issue.

Cheers!

Source: this article

Check out our other popular articles:

 

Leave a Comment