Peymankh Peymankh - 1 year ago 77
Git Question

Fetch from one git server and push to another server using Jenkins

I have a local git server (centOS) where everyone pushes their work to that repository. Jenkins manages to build whatever in that repository is, overnight. Lately I've got a Git Enterprise account. I've been wondering if there's any way to force Jenkins to 1) Only pulls the code from the local server and 2) Whenever a build was successful, sends the code to git enterprise remote repository.

I'm using Jenkins v. 1.458

Answer Source

well, one option would be to just create a script that does this from bash...but...

You can just add two git repositories under the "source code management" section after installing the Multiple SCMs plugin, and then specify that you want to build REPOLOCALNAME/branch, and then at the end under 'Git publisher' specify you want to merge and push to the remote branch. (ie. BranchToPush=branchname and TargetRemoteName= REMOTEREPONAME)

*Remember, the names are specified under advanced options of the repository when you add it under the SCM section.

*I haven't tested this, there is a chance that it might let you only pull and push, from and to the same repository.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download