Jenkins git插件:如何配置不同的fetch和push git远程仓库?

3
我有一个Jenkins项目,其中包含Git检出URL。该Jenkins主服务器已配置为使用Git-Jenkins插件版本2.2.10_2 (https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin)。
我想知道是否有方法可以为提取和推送提供不同的Git远程库。
e.g: $ git remote -v
origin  git@<read-only-git>.com:org/repo.git (fetch) 
origin  git@<read-write-git>.com:org/repo.git (push) 

这里的用例是使用只读源进行克隆,并将任何更改推回读写源。有外部同步机制来更新只读副本。
谢谢,
-Mayur
1个回答

2

使用git remote set-url命令的--push选项。

假设您是从只读存储库克隆的:

之前

$ git remote -v
origin  git@<read-only-git>.com:org/repo.git (fetch) 
origin  git@<read-only-git>.com:org/repo.git (push) 

命令

git remote set-url --push origin git@<read-write-git>.com:org/repo.git

之后

$ git remote -v
origin  git@<read-only-git>.com:org/repo.git (fetch) 
origin  git@<read-write-git>.com:org/repo.git (push) 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接