Error: Git Detected Dubious Ownership

Error: Git Detected Dubious Ownership

Problem

When trying to create, edit, or push changes to a component in IguanaX, you receive an error similar to:

fatal: detected dubious ownership in repository at '<path>/IguanaX/config' '<path>/IguanaX/config' is owned by: '<OWNER>' but the current user is: '<CURRENT_USER>' To add an exception for this directory, call: git config --global --add safe.directory <path>/IguanaX/config

The owner and current user values will vary depending on your environment. Common examples include:

  • Owner is a user SID (e.g. S-1-5-21-...) and current user is S-1-5-18 (SYSTEM)

  • Owner is BUILTIN/Administrators (S-1-5-32-544) and current user is a service account (e.g. DOMAIN\svcAccount$)

  • Owner is NT AUTHORITY/SYSTEM (S-1-5-18) and current user is a service account (e.g. DOMAIN\svcAccount$)

Cause

This error occurs when there is a mismatch between the account that owns the IguanaX config directory and the account that is actually running the IguanaX service. Git includes a security check that prevents operations on repositories owned by a different user than the one executing the command.

Important Notes

Do not use git config --global --add safe.directory as a fix. While the error message suggests it, this only bypasses the security check without resolving the underlying ownership mismatch

Solution

The fix is to change the ownership of the config directory so it matches the account running the IguanaX service. If you change ownership to the wrong account, you may see the same error but with the owner and current user values swapped. Double-check which account IguanaX is running under (Step 1) and re-run with the correct target.

Step 1: Identify the Account Running IguanaX

  1. Open Windows Services (Win + S → type services.msc → Enter).

  2. Find IguanaX, right-click → Properties → Log On tab.

  3. Note the account listed. Common values:

    • Local System Account → target owner is NT AUTHORITY\SYSTEM

    • A domain/service account (e.g. DOMAIN\svcAccount$) → target owner is that account

Step 2: Stop the IguanaX Service

Stop the service before making changes (Services → right-click IguanaX → Stop).

Step 3: Change Directory Ownership

In the following commands, replace <config-path> with your actual path from the error message (e.g. C:\ProgramData\IguanaX\config), and replace <TARGET_ACCOUNT> with the account from Step 1.

Option 1: Command Prompt (Run as Administrator)
  1. Press Win + S, type cmd, right-click Command Prompt → Run as Administrator.

  2. Take ownership of the directory:

    takeown /f "<config-path>" /r /d y
  3. Grant ownership to the target account:

    If running as SYSTEM:

    icacls "<config-path>" /setowner "NT AUTHORITY\SYSTEM" /t /c

    If running as a domain/service account (e.g. DOMAIN\svcAccount$):

    icacls "<config-path>" /setowner "DOMAIN\svcAccount$" /t /c
    • /t applies the change recursively to all files and subdirectories.

    • /c ensures the command continues even if errors occur.

Option 2: PowerShell (Run as Administrator)
  1. Press Win + S, type powershell, right-click Windows PowerShell → Run as Administrator.

  2. Run:

    $path = "<config-path>" takeown /f $path /r /d y icacls $path /setowner "<TARGET_ACCOUNT>" /t /c

Step 4: Restart the IguanaX Service

Start the service and verify through the Dashboard that components are running as expected.