5

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://git@github.com/OrgName/MyRepo.git +refs/heads/*:refs/remotes/origin/*
exit 0

and it sticks on the fetch command, never exiting.

Does someone have any suggestion?

shytikov
  • 9,155
  • 8
  • 56
  • 103
Camron B
  • 1,650
  • 2
  • 14
  • 30

1 Answers1

4

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.

shytikov
  • 9,155
  • 8
  • 56
  • 103
  • The problem was that I installed with the "Run from Bash" option instead of "Run From Windows Command Line". Once I added the necessary environment variables, it worked like a charm, but only when I create a script to fetch. However, I like it that way, so I'll leave it. Thanks! – Camron B Nov 30 '11 at 17:17
  • @CamronBute it's good form to upvote an answer if it solved your problem ;-) – Benoit Garret Nov 30 '11 at 17:21