Deploy and build from source code on Bitbucket (git) fails with fatal: detected dubious ownership in repository

Rafał Jońca 26 Reputation points
2023-09-01T09:34:33.05+00:00

Hello,

On some of out App Service servers Git was updated to version 2.39.2.windows.1 which on sync with source code returns error like:

 fatal: detected dubious ownership in repository at 
'//172.17.160.7/volume-12-default/7fdb....
is owned by: 'S-1-5-21-xxx' but the current user is:'S-1-5-82-'
To add an exception for this directory, call:
 git config --global --add safe.directory '%(prefix)///172.17.160.7/volume-12-default/7fdb781'

The problem is that trying to add this exception as suggested returns below error:

error: could not lock config file C:/home/.gitconfig: Permission denied

On servers which still have older git version (2.35.0.windows.1) everything works properly as the ownership check was added in 2.35.2, but likely they will be updated soon.

Is there any other way to get the repository sync working again as we cannot create .gitconfig file or tweak file owners?

Regards,

Rafal

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

Accepted answer
  1. Orest Khrapko 85 Reputation points
    2023-09-04T15:32:01.0166667+00:00

    Thank you, worked for me. The only thing I would add that on Azure I was not able to create the file at the c:\home due to permission issues, but I was able to create that file in C:\home\site\wwwroot\my-git-config.txt that set GIT_CONFIG_GLOBAL to C:\home\site\wwwroot\my-git-config.tx

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Rafał Jońca 26 Reputation points
    2023-09-04T04:38:00.5333333+00:00

    After some tries I come up with workaround that may not be ideal, but works.

    In App Service configuration add environment variable GIT_CONFIG_GLOBAL and point it to a text file you created in c:\home. In the file you can add below content:

    [safe]
        directory = *
    

    After service restart git will skip the ownership test as it would in version 2.35.0.

    1 person found this answer helpful.

  2. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-09-18T19:04:46.9933333+00:00

    Thanks for sharing the solution that worked for you, Orest Khrapko and Rafał Jońca!

    Following-up with an update. ( tracking here)

    There was a bug identified. The fix has been rolled out by our product engineering team.

    Thanks for your patience!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.