php – 在Jenkins中找不到私有git子模块
问题
我正在尝试在Jenkins中构建我的应用程序,它在Github上的私有仓库中,也有一个私有子模块. 我可以通过设置它的凭据来克隆Jenkins中的私有存储库,但是Jenkins无法克隆子模块,这是失败构建的输出: Started by an SCM change Building in workspace /var/lib/jenkins/jobs/Project/workspace Fetching changes from the remote Git repository Fetching upstream changes from git@github.com:user/repogit using GIT_SSH to set credentials Checking out Revision 9cc99b67cc676d0ea8ccd489a8327f5c6dbb8d7f (origin/branch) [workspace] $/bin/sh -xe /tmp/hudson2710403018107019432.sh + git submodule update --init --recursive Initialized empty Git repository in /var/lib/jenkins/jobs/repository/submodule/.git/ ERROR: Repository not found. fatal: The remote end hung up unexpectedly Clone of 'git@github.com:user/submodule.git' into submodule path 'repository/submodule/' failed Build step 'Execute shell' marked build as failure Discard old builds... #156 is removed because status FAILURE is not to be kept Publishing Clover coverage report... No Clover report will be published due to a Build Failure Sending e-mails to: Finished: FAILURE 这是我在jenkins尝试过的事情 >尝试设置附加行为“高级子模块行为”,但没有成功. git submodule update –init –recursive >试图在我的子模块的项目上设置一个git存储库,而不仅仅是正在测试的主存储库,也没有运气. 所有这些都会导致错误,表明Jenkins无法找到子模块的存储库. 有什么想法我怎么解决这个? (用户名,路径和存储库是正确的,我刚刚将它们更改为在此处发布) 解决方法
解决了.在我的凭证中,我使用的是直接SSH密钥(选项“直接输入”),而不是放入文件中.
我只是将键(公共和私有)放在?/ .ssh中,并将我的凭据更改为选项“From the Jenkins master~ / .ssh”. 问题是子模块没有使用我已经指定给主存储库的凭证,它试图使用默认的ssh密钥(.ssh / id_rsa). 另一个解决方案是将-i my_key传递给git子模块步骤(如果你的密钥不在默认路径中,则只需要这个(?/ .ssh / id_rsa)) 另外不要忘记给你的密钥赋予正确的权限,在我的情况下我必须: chown apache ~/.ssh/id_rsa* chmod 700 ~/.ssh/id_rsa* (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |