36

In Visual Studio 2019, we have been using the GitHub extension successfully since before release. Now, all of the sudden, when we push, pull, or sync, we receive the following in the Output window:

Warning: 'C:\ProgramData/Git/config' has a dubious owner: '(unknown)'.
For security reasons, it is therefore ignored.
To fix this, please transfer ownership to an admininstrator.
ArunPratap
  • 4,816
  • 7
  • 25
  • 43
Bullfrog Software
  • 473
  • 1
  • 4
  • 9
  • What user/group owns `C:\ProgramData\Git\config`? (Here it is the (local) Administrators group.) – Richard Aug 21 '19 at 14:45
  • Here as well, the owner is the local Administrators group, on the location and the 'config' file. – Bullfrog Software Aug 22 '19 at 19:14
  • The message claims the owner is `(unknown)` - does it have a direct owner? or is it just that the unknown ownwer is part of the admin group? (stupid questions, I know..) – Philip Oakley Aug 25 '19 at 11:15
  • 1
    **Note** the latest version of Git for Windows (2.24.0) has changed the location of the global configuration, it is now just `C:\Program Files\Git\etc\gitconfig` (and no longer split between two locations). – Richard Nov 06 '19 at 11:33
  • After a fresh install of windows and VS Community 2019, there will be no such file (indeed not even C:\ProgramData). Why is VS's built-in Git expecting it to be there? After installing latest Git for windows (2.24.0), as @Richard pointed out, the correct path to that file is C:\Program Files\Git\etc\gitconfig. I do not think manually creating the path and file is the correct solution… – ctb Nov 18 '19 at 20:09

11 Answers11

52

You should check if 'C:\ProgramData/Git/config' actually exists. If it doesn't you can just create it and paste the following into the file:

[core]
    symlinks = false
    autocrlf = true
    fscache = true
[color]
    diff = auto
    status = auto
    branch = auto
    interactive = true
[help]
    format = html
[rebase]
    autosquash = true

This worked for me.

Chris Dueck
  • 682
  • 8
  • 17
  • 1
    We had 2 separate development machines. On machine 1, the file existed, but the contents were different from above. On machine 2, the file did not exist at all. We made sure the file was present and the contents were as above on both machines, and now no warnings. Problem solved, but no reason why it happened. Thanks! – Bullfrog Software Aug 28 '19 at 13:22
  • 1
    What Will be the extension of config file? – Maulik Modi Nov 05 '19 at 12:21
  • @MaulikModi There is no extension specified, windows will simply list its type as 'File'. – Chris Dueck Nov 06 '19 at 19:30
  • 1
    Yes, revisited this post because we had to do it again on a new development computer. @ChrisDueck is correct. No extension. Simply name it 'config' – Bullfrog Software Nov 27 '19 at 16:15
  • This answer worked for me after upgrading Visual Studio 2017 to version 15.9.17. I'm wondering if this happened when I uninstalled the previous version (due to upgrade failing). – Paul Syfrett Feb 27 '20 at 22:27
7
  • Select "Tools" in Visual studio
  • Select "Get_tools_and_features"-->It will open the visual studio installer
  • Click on the "Individual_components" tab in visual studio installer
  • Go to "Code_tools" and check "GitforWindows" and "GitextensionforVisualStudio"
  • Install these two to resolve this issue.

99% sure that above steps will fix the error.

Nagendra Reddy
  • 531
  • 5
  • 7
5

I fixed it by going to Visual Studio Installer, choosing individual component and searching for "Git". In my case the "Git for Windows" and "GitHub Extension for Visual Studio" was now unchecked/not installed for some reason..

These are the extensions I needed: Visual Studio Installer Git

Installing those create the ProgramData\Git\config file and the error was gone.

Philip Küsel
  • 51
  • 1
  • 1
3

We ran into this exact issue after upgrading Git to version 2.23.0.windows.1 on our build agents.

The fix that worked for us was to change the owner of C:\ProgramData/Git/config to Administrators. Note that this is different to the Administrator user!

To do this, right-click on C:\ProgramData/Git/config and select Properties then the Security tab.

config Properties

And click Advanced...

Advanced Security Settings for config

Use the Change link to set the owner to Administrators.

Richard Ev
  • 52,939
  • 59
  • 191
  • 278
1

Delete or rename the existing file at that location is also an option. It looks like it's parts of some lower level windows (or MSYS2/Cygwin) security that's brought in via libgit.lib.

Why the created file has the wrong owner is not yet known.

Who/what is the owner for that existing file? What language is in use?

It's been noted as an issue at https://github.com/git-for-windows/git/issues/2304 but isn't resolved yet.

Philip Oakley
  • 13,333
  • 9
  • 48
  • 71
1

Uninstall Git and install a downgraded version. The version that shows this problem is the 2.23.0. Downgrade it to the 2.22.0 and it works fine without this problem.

Git releases: All git releases Git 2.22.0: Version without this issue

0

Delete the file config file from C:\ProgramData/Git directory and try again.

NK_Mimrot
  • 332
  • 2
  • 12
0

I had this problem with Git 2.24.0.2 and visual studio 2019 - 16.2.3. I couldnt create the path and config file in c:/ProgramData/git/, as I dont have admin rights. It turned out that the windows credentials stored are expired for my user account and when updated using control panel > user accounts > credential manager > Generic credentials for git helped to resolve the issue in my case

Learner
  • 71
  • 1
  • 3
0

The "Git" folder was missing from the path c:/ProgramData/Git/Config. I created the folder (not the config file) and it worked fine

0

Try using Visual Studio GIT extension and open Visual Studio as Administrator if you face below issue

warning: unable to access 'c:\programdata/git/config': permission denied warning has a dubious owner: '(unknown) git please transfer ownership to an administrator github config has a dubious owner

0

I had the same problem and I tried some of the tips given above but the problem keep existed. Then I directly went and updated the visual studios Installer and the problem fixed.

Mugu
  • 1
  • 2