Jenkins git 插件:如何配置不同的获取和推送 git 遥控器?

Jenkins git plugin: How to configure different fetch and push git remotes?

我有一个 Jenkins 项目,其中有一个 git 签出 url。 Jenkins master配置了git-Jenkins plugin version 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) 

这里的用例是为克隆使用只读源并将任何更改推送回读写源。有一个外部同步机制来更新只读副本。

谢谢,

-马约尔

使用 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)