Jenkins对私人GitHub存储库(Windows)不擅长 [英] Jenkins not playing nice with a private GitHub repository (Windows)

查看:196
本文介绍了Jenkins对私人GitHub存储库(Windows)不擅长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法为了我的生活似乎让我的Jenkins CI与Github一起工作。



我在克隆命令上失败了,但那是由于键,所以我以服务帐户登录(用户Jenkins作为Windows服务运行)并运行克隆命令。一切都很好。



然而,当我想运行获取最新版本时,它不会完成。它只是坐在那里。我已经通过Jenkins的Git插件尝试过,并且还通过Windows命令行脚本尝试过。既没有工作。但是,如果我打开命令提示符并在其中键入命令,它将起作用!



那么我怎么才能通过Jenkins使用它?



我运行这个脚本:

  set 
C:\程序文件(x86)\Git\bin\git.exefetch -t ssh://git@github.com/OrgName/MyRepo.git + refs / heads / *:refs / remotes / origin / *
exit 0

它坚持使用fetch命令,永远不会退出。



有人有任何建议吗?

解决方案


$ b $看起来像msysGit一直在试图找到它的一个组件, b

实际上,Git本身并不是一个可执行文件。这是一组小工具,他们的工作只能放在一起。在bash提示符下在Windows上运行Git使它成为现实,但是当你通过Windows命令提示符或批处理文件运行时,Force可能不在你身边。



我想你应该检查你安装了msysGit的选项从Windows命令提示符运行Git。在这种情况下,所有需要的Git部分将被添加到系统中 PATH 变量中,并且 git.exe 将能够从批处理文件中访问它,因此它应该修复你的 fetch 语句。


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?

解决方案

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.

这篇关于Jenkins对私人GitHub存储库(Windows)不擅长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆