Detached heads are not currently supported

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Unable to access the repository.

The following appears in the atlassian-bitbucket.log:

1 2 3 4 5 2013-10-09 09:41:04,642 ERROR [http-bio-7990-exec-8] sdh 581x6964x1 ob79br 192.168.3.62 "GET /projects/TST/repos/reponame/browse HTTP/1.1" c.a.s.i.w.HandlerExceptionResolverImpl Detached heads are not currently supported. Please ensure the HEAD for BMS-Utils (2) is a reference com.atlassian.bitbucket.scm.git.DetachedHeadException: Detached heads are not currently supported. Please ensure the HEAD for reponame (2) is a reference at com.atlassian.bitbucket.internal.scm.git.RawGitAgent.getHead(RawGitAgent.java:258) ~[na:na] at com.atlassian.bitbucket.internal.scm.git.RawGitAgent.resolveHead(RawGitAgent.java:310) ~[na:na] at com.atlassian.bitbucket.internal.scm.git.DefaultGitCommandFactory$1.call(DefaultGitCommandFactory.java:202) ~[na:na]

Cause

Detached heads are not currently supported.

Resolution

  1. Check the repository ID:

    1 SELECT id FROM repository WHERE name='<reponame>';
  2. Go to the directory where Bitbucket Server repository data is located, e.g.:

    1 cd BITBUCKET_HOME/shared/data/repositories/<ID>
  3. Run the following command to see the content of the file HEAD:

    1  cat HEAD

    If it return a commit hash (e.g.: 682408a83a7bb1bd6a1ff9695c68272bf3627f74), your repository is in detached HEAD state.

  4. Run the following command to set it back to master branch or any other default branch:

    1  git symbolic-ref HEAD refs/heads/master
Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.