Jenkins的git插件配置 [英] Jenkins configuration of git plugin

查看:233
本文介绍了Jenkins的git插件配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在新的jenkins项目中配置git repo时出现此错误:

I get this error when configuring git repo in a new jenkins project:

Failed to connect to repository : Error performing command:  ls-remote -h file:///c:\Dev\git\rx HEAD

我在Windows机器上有一个本地git repo,并且从命令提示符中克隆相同的路径可在同一台机器上工作.我不知道可能是什么问题(git.exe在系统路径上)

I have a local git repo on my windows machine and cloning the same path from command prompt works on the same machine. I don't know what could be the problem (git.exe is on system path)

推荐答案

Windows 将Jenkins安装为服务.但是它在没有访问GIT权限的不同用户权限下运行Jenkins服务.您可以单击此链接找到Jenkins所运行的用户. http://antagonisticpleiotropy.blogspot.com/2012/08/running-jenkins-in-windows-with-regular.html

Windows installs Jenkins as a service. But it runs the Jenkins service under different user permissions that don't have access to GIT. You can follow this link to find the user that Jenkins runs under. http://antagonisticpleiotropy.blogspot.com/2012/08/running-jenkins-in-windows-with-regular.html

例如.我在Windows上的本地用户名是"nathandrewsire",不包括引号.打开Windows服务管理器(cmd和c:\ services.msc,或使用Windows键+ R).启用登录>此帐户:.然后输入.\ username(例如.\ nathandrewsire).然后重新启动服务,您将可以从Jenkins版本访问GIT.

For example. My local user name on my windows is "nathandrewsire", exclude the quotes. Open windows services manager (either cmd and c:\services.msc, OR use windows key + R). Enable Log On > This account:. Then type in .\username (e.g. .\nathandrewsire). Then restart the service and you will have access to GIT from Jenkins builds.

我还找到了Windows Shell命令的代码段,该代码段将输出用户进行验证. 回声%PATH% 回声%USERDOMAIN%\%USERNAME%

I also found a snippet for windows shell command that will output the user to verify it. echo %PATH% echo %USERDOMAIN%\%USERNAME%

http://antagonisticpleiotropy.blogspot .com/2012/08/running-jenkins-in-windows-with-regular.html

如果您使用的是Linux,则可能是由于未在Git存储库上启用共享而导致的.除非...,否则Linux jenkins用户将无法访问其他用户下的Git报告. git --bare init --shared=group 另外,您的jenkins用户和Git存储库用户必须属于同一组,才能访问文件权限.还有其他替代方法,例如将umask和ACL弄乱,但是为两个用户设置linux组是最简单的方法.

If you're using Linux, this error can also be caused from not enabling share on your Git repo. Linux jenkins user won't be able to access Git report under another user unless.... git --bare init --shared=group Also, your jenkins user and Git repo user must belong to the same group for file permission access. There's other alternatives to that like messing with umasks and ACL's but setting up a linux group for your two users is the easiest way.

请确保不要使用光头的init命令覆盖您的Git存储库.如果您已经有一个Git仓库,则需要使用共享选项设置/移动到新仓库.我没有找到将现有存储库转换为共享的方法,因为我猜这些文件都需要更新?

Make sure NOT TO OVERWRITE your Git repo with the bare init command. If you already have a Git repo, you'll need to setup/move to a new one with the shared option. I didn't see a way to convert existing repos to shared because I am guessing the files would all need to be updated?

注意*** 我使用VMWare Workstation共享文件夹在Windows guest虚拟机上构建.詹金斯在进入Git仓库时需要以下格式.

NOTE*** I used VMWare Workstation shared folders to build on a windows guest. Jenkins needs the following format when entering the Git repo.

//vmware-host/Shared Folders/vm-share/ridcyDevelopment.git/

无法让Jenkins和Git玩的开心

这篇关于Jenkins的git插件配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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