1

I have a GitHub Organization set up on my Jenkins box and am using a multi-branch pipeline configuration to build my projects. I configured everything on a fresh install of the latest Jenkins release using the Blue Ocean UI.

When Jenkins checks out a project for a build, it does so using the command git checkout -f {hash} which leaves the working directory in a "detached HEAD" state. Our gradle build scripts depend on introspecting the current working directory to find out information about the current branch, which fails in this scenario.

This problem seems to be fairly well documented (eg. here), but in all cases the solution seems to be to set an option named Checkout/merge to local branch (optional) in the git settings for the project. In my setup, I cannot find this setting anywhere. I've looked at the Organization, Project, and individual Branch level with no luck.

Is there another means to get Jenkins to checkout to a local branch?

AwesomeTown
  • 2,668
  • 2
  • 21
  • 36

0 Answers0