git 最新更新在拉、推或同步时带来 Github 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/57592530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Latest Update brings Github error on pull, push, or sync
提问by Bullfrog Software
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:
在 Visual Studio 2019 中,我们从发布之前就成功使用了 GitHub 扩展。现在,突然之间,当我们推、拉或同步时,我们会在“输出”窗口中收到以下信息:
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.
回答by Chris Dueck
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:
您应该检查 'C:\ProgramData/Git/config' 是否确实存在。如果没有,您可以创建它并将以下内容粘贴到文件中:
[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.
这对我有用。
回答by Philip Küsel
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..
我通过转到 Visual Studio 安装程序,选择单个组件并搜索“Git”来修复它。在我的情况下,“Windows 版 Git”和“Visual Studio GitHub 扩展”现在由于某种原因未选中/未安装。
These are the extensions I needed: Visual Studio Installer Git
这些是我需要的扩展: Visual Studio Installer Git
Installing those create the ProgramData\Git\config file and the error was gone.
安装这些会创建 ProgramData\Git\config 文件,错误消失了。
回答by Nagendra Reddy
- 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.
- 在 Visual Studio 中选择“工具”
- 选择“Get_tools_and_features”-->它将打开visual studio安装程序
- 单击 Visual Studio 安装程序中的“Individual_components”选项卡
- 转到“Code_tools”并检查“GitforWindows”和“GitextensionforVisualStudio”
- 安装这两个来解决这个问题。
99% sure that above steps will fix the error.
99% 确定上述步骤将修复错误。
回答by Philip Oakley
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.
删除或重命名该位置的现有文件也是一种选择。看起来它是通过 libgit.lib 引入的一些较低级别的窗口(或 MSYS2/Cygwin)安全性的一部分。
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/2304but isn't resolved yet.
在https://github.com/git-for-windows/git/issues/2304 上已将其视为一个问题,但尚未解决。
回答by Richard Ev
We ran into this exact issue after upgrading Git to version 2.23.0.windows.1 on our build agents.
在我们的构建代理上将 Git 升级到版本 2.23.0.windows.1 后,我们遇到了这个确切的问题。
The fix that worked for us was to change the owner of C:\ProgramData/Git/configto Administrators. Note that this is different to the Administratoruser!
对我们有用的修复是将C:\ProgramData/Git/config的所有者更改为Administrators。请注意,这与管理员用户不同!
To do this, right-click on C:\ProgramData/Git/configand select Propertiesthen the Securitytab.
为此,右键单击C:\ProgramData/Git/config并选择属性,然后选择安全选项卡。
And click Advanced...
然后点击高级...
Use the Changelink to set the owner to Administrators.
使用更改链接将所有者设置为管理员。
回答by Gabriele D'Agostino
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 并安装降级版本。显示此问题的版本是 2.23.0。将其降级到 2.22.0,它可以正常工作,没有这个问题。
Git releases: All git releasesGit 2.22.0: Version without this issue
回答by Learner
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
我在 Git 2.24.0.2 和 Visual Studio 2019 - 16.2.3 上遇到了这个问题。我无法在 c:/ProgramData/git/ 中创建路径和配置文件,因为我没有管理员权限。事实证明,我的用户帐户存储的 Windows 凭据已过期,当使用控制面板 > 用户帐户 > 凭据管理器 > git 的通用凭据更新时,帮助解决了我的问题
回答by Trevor Smith
The "Git" folder was missing from the path c:/ProgramData/Git/Config. I created the folder (not the config file) and it worked fine
路径 c:/ProgramData/Git/Config 中缺少“Git”文件夹。我创建了文件夹(不是配置文件)并且运行良好
回答by NK_Mimrot
Delete the file config
file from C:\ProgramData/Git
directory and try again.
config
从C:\ProgramData/Git
目录中删除文件文件并重试。
回答by Ummer Irshad
Try using Visual Studio GIT extension and open Visual Studio as Administrator if you face below issue
如果您遇到以下问题,请尝试使用 Visual Studio GIT 扩展并以管理员身份打开 Visual Studio
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
警告:无法访问“c:\programdata/git/config”:权限被拒绝警告有一个可疑的所有者:“(未知)git 请转让所有权给管理员 github 配置有一个可疑的所有者