KodeKloud task failed: /opt/apps.git detected as non-bare despite git init --bare

Git level4 5
I’m getting the following validation error in a KodeKloud Engineer task:

'/opt/apps.git' git repository on storage server is not a bare repository

However, I created the repository as a bare repository using:

sudo git init --bare /opt/apps.git

The repository structure also looks like a normal bare repository:

/opt/apps.git/
├── HEAD
├── config
├── description
├── hooks/
├── info/
├── objects/
└── refs/

I also successfully configured the update hook.

The xfusioncorp_apps branch was pushed successfully, and when I tried to push master, the hook correctly rejected it:

remote: Manual pushes to the master branch is restricted!!
remote: error: hook declined to update refs/heads/master

I changed the ownership of /opt/apps.git to natasha:natasha because I initially encountered a permission error when pushing:

sudo chown -R natasha:natasha /opt/apps.git

As far as I understand, changing ownership should not change whether the repository is bare or non-bare.

The current contents of /opt/apps.git are:

drwxr-xr-x 6 natasha natasha 4096 Aug 24 02:19 .
-rw-r--r-- 1 natasha natasha   23 Aug 24 02:19 HEAD
-rw-r--r-- 1 natasha natasha   66 Aug 24 02:19 config
-rw-r--r-- 1 natasha natasha   73 Aug 24 02:19 description
drwxr-xr-x 2 natasha natasha 4096 Aug 24 02:20 hooks
drwxr-xr-x 2 natasha natasha 4096 Aug 24 02:19 info
drwxr-xr-x 7 natasha natasha 4096 Aug 24 02:24 objects
drwxr-xr-x 4 natasha natasha 4096 Aug 24 02:19 refs

I have already retried the task twice and received the same validation error.

Could someone please confirm whether I’m missing something, or whether this might be a validator issue?

Sorry. I just noticed that this had already been discussed here:

My apologies for the duplicate question.
I tried running all the commands with sudo, and it worked successfully.

No problem. But yes, changing the ownership would indeed annoy the grader :slight_smile:

1 Like