首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Jenkins中使用多个repos生成库的Git push未发现错误

在Jenkins中使用多个repos生成库的Git push未发现错误
EN

Stack Overflow用户
提问于 2015-02-26 15:56:33
回答 1查看 553关注 0票数 0

我在“源代码管理”部分配置了一个包含多个存储库的Jenkins作业,每个库都有一个“自定义”源名称。用例是,我需要从第一个回购中提取一个校验和值,然后使用它更新第二个回购中的文件,并将更改推到远程回购。以下是Jenkins作业输出的样子:

代码语言:javascript
复制
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from 2 remote Git repositories
 > git config remote.second-origin.url git@github.com:user/repo-2.git # timeout=10
Fetching upstream changes from git@github.com:user/repo-2.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git fetch --tags --progress git@github.com:user/repo-2.git +refs/heads/*:refs/remotes/second-origin/*
 > git config remote.first-origin.url git@github.com:user/repo-1.git # timeout=10
Fetching upstream changes from git@github.com:user/repo-1.git
using GIT_SSH to set credentials 
 > git fetch --tags --progress git@github.com:user/repo-1.git +refs/heads/*:refs/remotes/first-origin/*
Seen branch in repository second-origin/development
Seen branch in repository second-origin/master
Seen branch in repository first-origin/master
Seen branch in repository first-origin/test
Seen 4 remote branches
Checking out Revision 15j5123hjhjkl5123jk512hjkl5hjk5jhkl (first-origin/test)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 15j5123hjhjkl5123jk512hjkl5hjk5jhkl
 > git rev-list 15j5123hjhjkl5123jk512hjkl5hjk5jhkl # timeout=10
[Jenkins Job] $ /bin/sh -xe /tmp/hudson2801366816478454446.sh
+ git config --global user.name jenkins-deploy
+ git config --global user.email jenkins-deploy@test.com
+ git checkout first-origin/master
Previous HEAD position was 15j51... Some stuff
HEAD is now at f2f34af23.. Merging master
++ git rev-parse HEAD
+ echo f2f34af23a2g3hLKJHGQLK2HJ > current.rev
+ git branch -d development
warning: deleting branch 'development' that has been merged to
         'refs/remotes/second-origin/development', but it is not yet merged to HEAD.
Deleted branch development (was 15bfafb).
+ git checkout -b development second-origin/development
Previous HEAD position was f8c45cf... Merging master
Switched to a new branch 'development'
Branch development set up to track remote branch development from second-origin.
+ cat current.rev >> file-changed.txt
+ git add file-changed.txt
+ git commit -m 'updating file-changed.txt'
[development 4fd83aa] updating file-changed.txt
 1 files changed, 1 insertions(+), 1 deletions(-)
+ git push second-origin development
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
Build step 'Execute shell' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE

我也尝试过git push命令的每一种风格,但都没有用:

代码语言:javascript
复制
git push -u second-origin development
git push
git push development
git push second-origin/development
git push second-origin:development
git push second-origin
git push remotes/second-origin
git push remotes/second-origin/development
git push second-origin user/repo-2/development
git push second-origin user/repo-2:development
git push second-origin user/repo-2 development

我有一种感觉,这与Jenkins插入git config core.sparsecheckout有关,但在这个主题上找不到任何有用的东西。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-02-26 17:17:11

我通过更新shell命令修复了这个问题:

  1. 让它做一个普通的git checkout second-origin/development
  2. 移除git推送,然后我使用Git Pulisher添加了一个构建后步骤,以从second-origin中推送我想要的分支。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28746968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档