在Jenkins中配置GitLab存储库 [英] Configure GitLab repository in Jenkins
问题描述
我试图配置Jenkins(在Windows Server 2008上运行)以连接到GitLab 6.0存储库(在Linux机器上)。
从我的本地窗口框我可以使用SSH URL来克隆我的GitLab服务器上的项目。我使用HTTP网址发布了一些问题,但我确实使用Eclipse插件管理使用HTTP进行连接。
-
在Jenkins项目配置屏幕上我尝试过:
>
无法连接到存储库:
命令d:\ tools \Git\bin\git.exe ls-remote -h http://myserver.domain/mygroup/myproject.git HEAD
返回状态码128: p>
stdout:stderr:错误:请求的URL返回错误:504访问
时
http://myserver.domain/mygroup/myproject.git/info/refs?service = git-upload-pack
$ b致命:HTTP请求失败
当我在浏览器我得到一个认证弹出。如果我输入我的电子邮件&密码我可以成功下载分支机构名单&标签。
-
...好吧,我应该能够指定用户名&密码在URL中,对吗?
http:// username:password@myserver.domain/mygroup/myproject.git
... nope: -
使用SSH的Windows GUI没有任何问题。
...詹金斯似乎并不喜欢那么多:
git@myserver.domain:mygroup / myproject.git
<$ c $>请输入Git存储库的错误仍然存在, c> Exception:java.lang.RuntimeException:无法实例化类hudson.plugins.git.G itSCM from
{value:2,
userRemoteConfigs:
{url:git@myserver.domain:mygroup / myproject.git,
name:origin,refspec:
},
branches:{name:},
includedRegions:,excludedRegions :,excludedUsers:,
localBranch:,ativeTargetDir:,reference:,
scmName:,
gitConfigName:,gitConfigEmail:,
pruneBranches:false,skipTag:false,clean:false,remotePoll:false,
disableSubmodules :false,recursiveSubmodules:false,
authorOrCommitter:false,wipeOutWorkspace:false,ignoreNotifyCommit:false,
useShallowClone:false,:[, 0],
gitTool:默认,
浏览器:{stapler-class:hudson.plugins.git.browser.FisheyeGitRepositoryBrowser}
Stacktrace:
javax.servlet.ServletException:
java.lang.RuntimeException:未能在org.kohsuke.stapler中从{...}
实例化类hudson.plugins.git.GitSCM .Stapler.tryInvoke(Stapler.jav a:725)
...
导致:java.lang.RuntimeException:无法在hudson.model实例化{...}
中的类hudson.plugins.git.GitSCM。 Descriptor.newInstance(Descriptor.java:617)
...
引起:java.lang.NullPointerException $ b $ h at hudson.scm.RepositoryBrowser.normalizeToEndWithSlash(RepositoryBrowser.java:85)
at hudson.plugins.git.browser.FisheyeGitRepositoryBrowser。< init>(FisheyeGitRepositoryBrowser.java:37)
-
我尝试添加ssh协议:
ssh://git@myserver.domain:mygroup / myproject.git
http:// username:password@myserver.domain/mygroup/myproject.git/info/refs 无效:这是一个git存储库吗?
詹金斯立即反应:
lockquote
stderr: ssh:myserver.domain:mygroup:没有与名称关联的地址
$ b 致命:无法从远程存储库读取数据。
请确保您拥有正确的访问权限并存在存储库。
由于我评论:
可能Jenkins不支持scp语法(使用':')尝试
ssh://git@myserver.domain/mygroup/myproject.git
如 .ssh配置与amazon ec2和git 中所述,使用':
'通常包含一个〜/ .ssh / config文件
,它将':'前面的字符串解析为一个服务器,用户,端口和ssh密钥。
Jenkins可能更好理解 git@myserver.domain/mygroup/myproject.git
而不是 git@myserver.domain:mygroup / myproject.git
。
I'm trying to configure Jenkins (running on Windows Server 2008) to connect to a GitLab 6.0 repository (on a linux box).
From my local windows box I can use the SSH URLs to clone the projects on my GitLab server. I've had some issues using the HTTP URLs, but I did manage to connect using HTTP with authentication using the Eclipse plugin.
On the Jenkins project config screen I have attempted:
Failed to connect to repository :
Command "d:\tools\Git\bin\git.exe ls-remote -h http://myserver.domain/mygroup/myproject.git HEAD"
returned status code 128:
stdout: stderr: error: The requested URL returned error: 504 while accessing
http://myserver.domain/mygroup/myproject.git/info/refs?service=git-upload-pack
fatal: HTTP request failed
When I try this URL in a browser I get an authentication popup. If I enter my email & password I can successfully download the list of branches & tags.
...Okay, so I should be able to specify the username & password in the URL, right?
http://username:password@myserver.domain/mygroup/myproject.git
...nope:
http://username:password@myserver.domain/mygroup/myproject.git/info/refs not valid: is this a git repository?
The Windows GUIs didn't have any trouble using SSH.
...Jenkins doesn't seem to like that much though:git@myserver.domain:mygroup/myproject.git
The error "Please enter Git repository" still remains, and when I attempt to save the config I see the following stack trace:
Exception: java.lang.RuntimeException: Failed to instantiate class hudson.plugins.git.GitSCM from {"value":"2", "userRemoteConfigs": {"url":"git@myserver.domain:mygroup/myproject.git", "name":"origin","refspec":"" }, "branches":{"name":""}, "includedRegions":"","excludedRegions":"","excludedUsers":"", "localBranch":"","relativeTargetDir":"","reference":"", "scmName":"", "gitConfigName":"","gitConfigEmail":"", "pruneBranches":false,"skipTag":false,"clean":false,"remotePoll":false, "disableSubmodules":false,"recursiveSubmodules":false, "authorOrCommitter":false,"wipeOutWorkspace":false,"ignoreNotifyCommit":false, "useShallowClone":false,"":["","0"], "gitTool":"Default", "browser":{"stapler- class":"hudson.plugins.git.browser.FisheyeGitRepositoryBrowser"} Stacktrace: javax.servlet.ServletException: java.lang.RuntimeException: Failed to instantiate class hudson.plugins.git.GitSCM from {...} at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:725) ... Caused by: java.lang.RuntimeException: Failed to instantiate class hudson.plugins.git.GitSCM from {...} at hudson.model.Descriptor.newInstance(Descriptor.java:617) ... Caused by: java.lang.NullPointerException at hudson.scm.RepositoryBrowser.normalizeToEndWithSlash(RepositoryBrowser.java:85) at hudson.plugins.git.browser.FisheyeGitRepositoryBrowser.<init>(FisheyeGitRepositoryBrowser.java:37)
I tried adding the "ssh" protocol:
ssh://git@myserver.domain:mygroup/myproject.git
Jenkins immediately reacts:
stderr: ssh: myserver.domain:mygroup: no address associated with name
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
As I commented:
Maybe Jenkins doesn't support the scp syntax (with ':
') Try
ssh://git@myserver.domain/mygroup/myproject.git
As mentioned in ".ssh config with amazon ec2 and git", using ':
' usually involves a ~/.ssh/config file
, which resolves the string preceding the ':' into a server, user, port and ssh key.
Jenkins might understand better git@myserver.domain/mygroup/myproject.git
instead of git@myserver.domain:mygroup/myproject.git
.
这篇关于在Jenkins中配置GitLab存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!