current Git branch is HEAD detached at

Issue

When you try to tagging or pulling your code Git said some thing like :

current Git branch is HEAD detached at 0ff123e

Environment

  • CloudBees Jenkins Enterprise
  • Git Plugin

Resolution

The default behaviour when you do a checkout from a commit is detached so, after checkout you need to attach to branch with a checkout command in a shell step.

 git checkout ${BRANCH_NAME}

from git checkout documentation

--detach

Rather than checking out a branch to work on it, check out a commit for inspection and discardable experiments. This is the default behavior of "git checkout <commit>" when <commit> is not a branch name. See the "DETACHED HEAD" section below for details.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.