Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins not playing nice with a private GitHub repository (Windows)

I cannot for the life of me seem to get my Jenkins CI to work with Github.

I had failure on the clone command, but that was due to keys, so I logged in as service account (the user Jenkins runs under as a Windows Service) and ran the clone command. All good in the hood.

However, when I want to run the fetch to get latest, it won't finish. It just sits there. I have tried via the Git plugin for Jenkins, and also via a Windows commandline script. Neither work. However, if I open a command prompt and type the command in, it works!

So how do I get it to work via Jenkins?

I run this script:

set
"C:\Program Files (x86)\Git\bin\git.exe" fetch -t ssh://[email protected]/OrgName/MyRepo.git +refs/heads/*:refs/remotes/origin/*
exit 0

and it sticks on the fetch command, never exiting.

Does someone have any suggestion?

like image 477
CamronBute Avatar asked Oct 10 '22 08:10

CamronBute


1 Answers

It looks like msysGit stuck trying to find one of its components, used during fetch operation.

The Git itself not a single executable actually. It's a set of small tools doing their job great only being put together. Running Git on Windows from bash prompt makes it happen, but when you're running via Windows command prompt or in batch-files, the Force may not be with you.

I think you should check wherever you installed msysGit with option "Run Git from Windows Command Prompt". In this case all needed parts of Git will be added to the system PATH variable and git.exe will be able to access it from batch files, thus it should fix your fetch statement.

like image 123
shytikov Avatar answered Oct 17 '22 00:10

shytikov