Skip to content

version 14.4.0 ce. gitlab-backup restore do not restore HEAD file

version 14.4.0 ce. gitlab-backup restore do not restore HEAD file

After a restore of data, clone command display a warning

$ git clone git@gitlab.int.hs.lu:systems/app-gitlab.git
Cloning into 'app-gitlab'...
remote: Enumerating objects: 54, done.
remote: Counting objects: 100% (54/54), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 54 (delta 21), reused 54 (delta 21), pack-reused 0
Receiving objects: 100% (54/54), 43.24 KiB | 0 bytes/s, done.
Resolving deltas: 100% (21/21), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

I found that on the server all repo 'HEAD' file ref to main branch that may not exists

cat /var/opt/gitlab/git-data/repositories/@hashed/0b/91/0b918943df0962bc7a1824c0555a389347b4febdc7cf9d1254406d80ce44e3f9.git/HEAD
ref: refs/heads/main

When changing the HEAD to the real HEAD branch (master or production for ex.) the clone do not display the error any more

how to reproduce

  • create repo with 'master' (or anything other than 'main') as default/protected branch. remove the 'main' branch
  • clone the repo -> no warning
  • backup, reinstall gitlab from scratch, restore gitlab from previous backup
  • clone the repo -> warning: remote HEAD refers to nonexistent ref, unable to checkout.
  • fix the HEAD file on the server (need to find the repo under /var/opt/gitlab/git-data/repositories/@Hashed)
  • clone the repo -> no more warning
Edited by Stephane Nsakala