文章目录

  • 环境
  • 原因
  • 解决方案
    • 变更文件夹权限
    • 设置git安全目录

环境

win10,git

原因

由于win10重装系统后,文件夹所有者变了,导致git pull等都出现了该问题

fatal: detected dubious ownership in repository at 'E:/xxxx'
'E:/xxxx' is owned by:'S-1-5-21-2006691667-4270939040-3929086740-1001'
but the current user is:'S-1-5-21-3445211471-1722826824-3856863527-1001'
To add an exception for this directory, call:git config --global --add safe.directory E:/xxxx

解决方案

变更文件夹权限


设置git安全目录

  • Git只允许您访问自己拥有的存储库,默认情况下,也就是运行Git的用户
  • 默认情况下,Git甚至会拒绝解析别人拥有的存储库的Git配置,更不用说运行它的钩子了,这个配置设置允许用户指定例外情况
  • safe.directory 这些配置项指定了git跟踪的目录,即使这些目录不是当前用户所拥有的,它们也被认为是安全的
#设置E:/xxx目录为安全目录
git config --global --add safe.directory E:/xxx#目录设置为字符串*。这将允许所有存储库被视为它们的目录被列在保险箱中。
git config --global --add safe.directory *

git config safe.directory 官网说明

safe.directory
These config entries specify Git-tracked directories that are considered safe even if they are owned by someone other than the current user. By default, Git will refuse to even parse a Git config of a repository owned by someone else, let alone run its hooks, and this config setting allows users to specify exceptions, e.g. for intentionally shared repositories (see the --shared option in git-init[1]).

This is a multi-valued setting, i.e. you can add more than one directory via git config --add. To reset the list of safe directories (e.g. to override any such directories specified in the system config), add a safe.directory entry with an empty value.

This config setting is only respected in protected configuration (see SCOPES). This prevents the untrusted repository from tampering with this value.

The value of this setting is interpolated, i.e. ~/expands to a path relative to the home directory and %(prefix)/expands to a path relative to Git’s (runtime) prefix.

To completely opt-out of this security check, set safe.directory to the string . This will allow all repositories to be treated as if their directory was listed in the safe.directory list. If safe.directory= is set in system config and you want to re-enable this protection, then initialize your list with an empty value before listing the repositories that you deem safe.

As explained, Git only allows you to access repositories owned by yourself, i.e. the user who is running Git, by default. When Git is running as root in a non Windows platform that provides sudo, however, git checks the SUDO_UID environment variable that sudo creates and will allow access to the uid recorded as its value in addition to the id from root. This is to make it easy to perform a common sequence during installation “make && sudo make install”. A git process running under sudo runs as root but the sudo command exports the environment variable to record which id the original user has. If that is not what you would prefer and want git to only trust repositories that are owned by root instead, then you can remove the SUDO_UID variable from root’s environment before invoking git.

fatal: detected dubious ownership in repository git报错解决相关推荐

  1. fatal: detected dubious ownership in repository at ‘D:/‘之解决方法

    1.今天在学习git的时候出现这个错误: 2.执行下面代码即可: git config --global --add safe.directory "*";

  2. 【Git】报错处理:fatal: detected dubious ownership in repository at .....Set the environment variable GIT_T

    [Git]报错处理:fatal: detected dubious ownership in repository at ..... 异常信息 解决 异常信息 Windows PowerShell 版 ...

  3. Git异常fatal: detected dubious ownership in repository at

    Git报错: $ git remote fatal: detected dubious ownership in repository at 'C:/Users/DELL/code/larabbs' ...

  4. git fatal: detected dubious ownership in repository 解决方法

    前言 最近windows 10 更新后,发现非常卡顿,鼠标右键,偶尔要等10秒才能有反应,无法系统还原,但是可以通过装机软件,进行重置,类似于系统重新安装 重置 windows 10后,因为更新了用户 ...

  5. git pull拉取报错fatal: detected dubious ownership in repository

    重装系统之后,项目的所有者发生了变化,导致git的文件夹权限错乱,无法进行git 操作. 1. git pull拉取报错 fatal: detected dubious ownership in re ...

  6. git 出现 : fatal: detected dubious ownership in repository

    使用git的时候突然出现 fatal: detected dubious ownership in repository at 'D:/Web/map-tiles-downloader_node' ' ...

  7. fatal detected dubious ownership in repository at解决办法

    转自:noerror.net 问题描述 执行git submodule update --init --recursive更新子模块时报错: fatal: detected dubious owner ...

  8. fatal: detected dubious ownership in repository at ‘/home/

    fatal: detected dubious ownership in repository at '/home/ To add an exception for this directory, c ...

  9. fatal: detected dubious ownership in repository at....

    显示如下: $ git remote add origin git@github.com:2002060229jby/timeseries_course.git fatal: detected dub ...

最新文章

  1. 【Centos】修改系统字符集
  2. 二十二.香港大学火星实验室R3LIVE框架跑官方数据集
  3. SpringBoot-拦截器
  4. 百度天链平台:企业区块链技术赋能产业创新落地
  5. FFmpeg Video Editor
  6. 我的超休闲游戏作品集
  7. C语言编写贪吃蛇游戏
  8. Linux: Manjaro/Arch logiops 罗技鼠标驱动安装教程
  9. Win10家庭版共享打印机
  10. AndroidStudio配置夜神模拟器
  11. RTMP、RTSP、m3u8、flv 区别及含义
  12. 阿里云服务器怎么更换ip?
  13. STM32F103VE基于标准库下DHT11数据串口打印输出
  14. 【本人秃顶程序员】分享一些数据结构与算法常用的算法技巧总结
  15. 用户管理系统_学期项目智能管理系统用户操作指南
  16. html取服务器时间,客户端获取服务器时间记时
  17. lol人数最多的服务器,谁说“黑色玫瑰”妹子最多?LOL国服各大服务器趣闻盘点...
  18. webpack打包js文件,图片路径错误,没有将图片打包的问题
  19. 优秀原型设计欣赏:交通类App原型制作分享-DiDi
  20. 无人便利店系统代理发展前景分析

热门文章

  1. 【图像处理算法常用数据集】整理第一弹
  2. ICLR 2022 | 商汤提出cosFormer:在注意力中重新思考Softmax
  3. 如何将数据移动到新硬盘(装机)
  4. c语言自动输入一位数字,c语言:要求输入一个四位整数,然后将各位数字按英文输出...
  5. ios获取系统自带的文字蓝色色值
  6. Oracle表空间时间点恢复技术TSPITR
  7. MLAPP————第六章 频率派统计
  8. 分布式商城项目--dubbo 服务的发布和引用。
  9. 红米4A手机刷开发版rom并且获取root权限
  10. C语言编程编制职工档案管理程序,c语言人事档案管理程序