git - 如何让 Jenkins 连接到 git 仓库

标签 git ssh jenkins gitweb

我无法让 Jenkins 识别我的 git 存储库。屏幕截图如下。有人告诉我使用 git clone https://blah/blah.git 会将 repo 克隆为只读,不需要凭据或 key 。我只想提取代码并构建它。

有趣的是,当我从命令行执行相同的命令时,它起作用了,文件从存储库中被 pull 下来。

export GIT_SSL_NO_VERIFY=true
git clone https://blah.com:8443/blah.git

当我在 Jenkins 中输入 url 和环境变量时,它说它无法连接到存储库。有谁知道我可能需要做什么才能让它工作?预先感谢您的帮助。

enter image description here

更新/澄清:Jenkins 安装在服务帐户下,与公司内的任何用户无关。

更新#2: 这是控制台输出。我已经对它进行了一些 sanitizer ,所以如果我遗漏了什么,我深表歉意。

Started by user anonymous
Building in workspace /home/hduser/.jenkins/workspace/analytics
Fetching changes from the remote Git repository
Fetching upstream changes from https://blah.com:8443/blah.git
FATAL: Failed to fetch from https://blah.com:8443/blah.gitt
hudson.plugins.git.GitException: Failed to fetch from https://blah.com:8443/blah.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:612)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:836)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:861)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:557)    
    at hudson.model.Run.execute(Run.java:1665)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:246)
Caused by: hudson.plugins.git.GitException: Failed to connect to https://blah.com:8443/blah.git
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getURLWithCrendentials(CliGitAPIImpl.java:1391)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.fetch(CliGitAPIImpl.java:167)
    at hudson.plugins.git.GitAPI.fetch(GitAPI.java:229)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:610)
    ... 10 more

最佳答案

感谢大家的建议、评论和帮助。我认为这是一个插件问题。其他人经历过与我相同的事情 (original post here) .如果我从命令行运行此命令,或者如果我在 Jenkins 中输入命令作为 Build>Execute shell>Command,它工作正常。

我有 Git 客户端插件 = 1.4.3 和 Git 插件 1.5.0。我会等着看是否有更新的插件解决了这个问题。

关于git - 如何让 Jenkins 连接到 git 仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19735232/

相关文章:

ruby-on-rails - 如何将旧提交部署到 Heroku

Git 在提交之间切换

git - msysgit 的 gvimdiff merge 工具

svn - 在工作副本中动态更改 SVN+SSH URI 中的用户名

ssh - 将 ssh key 字符串添加到 .ssh/authorized_keys 文件

c++ - hudson 、C++ 和 UnitTest++

git - 5 次提交到错误的分支并推送到远程/源

jenkins - 我们可以在 Jenkinsfile 的 'when' 中应用 'stages' 条件吗?

bash - Jenkins 管道 sh 在 Windows 上失败并显示 "cannot run program nohup"

git 忽略配置 core.sshcommand 但与 GIT_SSH_COMMAND= 一起工作正常