Jenkins How to solve Failed to connect to repository
Jenkins How to solve Failed to connect to repository
Failed to connect to repository
Error performing git command: git.exe ls-remote
Error performing git command: git.exe init
Step 1 - Check git is installed
Step 2 - If not install Git
Step 3 - Provide location of git.exe in Jenkins
Manage Jenkins > Global Tool Configuration > Git
All FREE courses - https://automationstepbystep.com/
Stories by Raghav - https://automationstepbystep.com/stor…
My Udemy Courses - https://automationstepbystep.com/udem…
----------- CI | CD | DEVOPS -----------
Jenkins Beginner - https://bit.ly/2MIn8EC
Jenkins Tips \u0026 Trick - https://bit.ly/2LRt6xC
Docker - https://bit.ly/2MInnzx
Kubernetes - http://bit.ly/2MJIlMK
---------- VERSION CONTROL SYSTEM -----------
Git \u0026 GitHub - https://bit.ly/2Q1pagY
GitLab - http://bit.ly/2kQPGyQ
Every LIKE \u0026 SUBSCRIPTION gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav
Content
0.61 -> Hello and welcome I am Raghav and in case
you are using Jenkins, and if you try to connect
6.45 -> to a Git repository and if you are getting
any of these errors, like failed to connect
12.169 -> to Git repository or error performing Git
command: git.exe ls-remote or you get error
20.301 -> performing Git command git.exe init In all
these cases, what you can do, let me show
26.71 -> you a demo So for example, I am on my Jenkins
and I will go to one of my jobs And if I go
33.46 -> to configure jobs and go to the source code
management section, you can see here I have
40.64 -> given a Git repository However, I am getting
this message failed to connect to Git repository,
48.75 -> error performing Git command, git.exe ls-remote
And if I run this job, I have tried to run
56.85 -> this job and let me show you the results in
the logs This is the attraction of the job
62.399 -> and if I go to the console output, so you
can see here Also, I am getting this option,
67.92 -> this message, error performing Git command
git.exe init Now in all these cases, the most
75.03 -> probable issue is that Jenkins is not able
to find the installation of it or the git.exe
82.38 -> on your system and it may happen that you
do not have git installed on your system So
87.92 -> in my case, if I see, I will go to my C drive
So which is the usual location for git installation
99.97 -> I will go to my C drive and here I will go
to program files and you can see I have git
105.44 -> here You can also find this in your C program
files X 86 or maybe some other location If
111.159 -> it is a different operating system and you
can see you have your git exe here or you
117.549 -> can go to Bin and you should have your git.exe
So this location should be available in Jenkins
124.95 -> So just in case you do not find this Git folder,
you can download and install it You can just
130.009 -> go to your browser, git download And here
you will go to this git-sem download You can
139.54 -> go here, it will download You can go here,
it will download it and then you can install
145.11 -> it on your system So this is step number one,
check git is installed and then step 2 is
155.25 -> if not, install git first and then step number
3 is provide location of git.exe in Jenkins
165.91 -> and you have to go to manage Jenkins So this
is manage Jenkins, and then you will go to
173.77 -> so let me go and check I will go to my Jenkins
dashboard and will go to manage Jenkins, and
180.66 -> you have to go to global tool configuration
here So this is global tool configuration
187.959 -> and then go to the git section.
190.319 -> So I will go here global tool configuration
and here go to the git section and here identify
198.29 -> if it is the default location, it should take
by default But if it is not the default location,
203.819 -> which is C Program Files (x86) or all these
locations, so Jenkins searches all these possible
211.85 -> locations If it does not find, you can always
provide the path here So something like this,
220.349 -> so this is the path of my git.exe And now
I will say, apply and save And now if I go
229.05 -> back to my job and let me see, I will go to
Configure And if I go to source code management,
238.62 -> you can now see the errors are now gone So
this is how you can have a solution for all
245.42 -> these possible issues of fail to connect to
the Git repository in Jenkins, I hope this
251.849 -> was useful Thank you for watching.
Source: https://www.youtube.com/watch?v=F5QKON50xP8