jenkinsci / jenkinsci/git-plugin

[JENKINS-31267] cannot push non-HEAD to remote repo

Open
#2,753 1 comment 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

Git publisher plug-in can push current HEAD to remote repo but does not allow arbitrary branch specifier.

What I'm doing is performing repo mirror periodically, e.g.

git push mirror origin/master:master

git push mirror origin/another_branch:another_branch

I have a workaround to use ssh agent environemnt plug-in + shell commands but would be nice if option to specify custom source branch is possible.

P.S. I see that mirroring can be done but only for a single branch per job definition. So if you have multiple branches to mirror it means extrapolating job number and making job management harder.

---
Originally reported by akostadinov, imported from: cannot push non-HEAD to remote repo


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 2025-12-02

Raw content of original issue

Git publisher plug-in can push current HEAD to remote repo but does not allow arbitrary branch specifier.

What I'm doing is performing repo mirror periodically, e.g.



git push mirror origin/master:master

git push mirror origin/another_branch:another_branch

I have a workaround to use ssh agent environemnt plug-in + shell commands but would be nice if option to specify custom source branch is possible.

P.S. I see that mirroring can be done but only for a single branch per job definition. So if you have multiple branches to mirror it means extrapolating job number and making job management harder.

  • environment: 1.609.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.