Detached heads are not currently supported

Problem

Unable to access the repository.

The following appears in the atlassian-bitbucket.log:

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:

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

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

     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:

     git symbolic-ref HEAD refs/heads/master

Last modified on Mar 9, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.