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

房东的猫 提交于 2019-12-10 13:43:41

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/8329021/jenkins-not-playing-nice-with-a-private-github-repository-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!