当前位置:   article > 正文

fatal unsafe repository (‘ xx path ‘ is owned by someone else)To add an exception for this directory

to add an exception for this directory

fatal: unsafe repository (’ xxx path ’ is owned by someone else)To add an exception for this directory

1. 本质是git升级导致的用户权限不足的问题
2. 异常
Admin@LAPTOP-CQKSUP6R MINGW64 /d/open_source/Interview
$ git add ./
fatal: unsafe repository ('D:/open_source/Interview' is owned by someone else)
To add an exception for this directory, call:

        git config --global --add safe.directory D:/open_source/Interview

Set the environment variable GIT_TEST_DEBUG_UNSAFE_DIRECTORIES=true and run

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
3. 添加 safe.directory 并执行
Administrator@LAPTOP-CQKSUP6R MINGW64 /d/open_source/Interview
$ git config --global --add safe.directory D:\open_source\Interview

  • 1
  • 2
  • 3
4. 查看配置列表

Administrator@LAPTOP-CQKSUP6R MINGW64 /d/open_source/Interview
$ git config --list
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=D:/devtools/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
user.email=haha@chain.com
user.name=haha
safe.directory=D:open_sourceInterview

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
5. 重新克隆
(添加 --recursive 参数)重新克隆,可以正常使用
Administrator@LAPTOP-CQKSUP6R MINGW64 /d/open_source/Interview
$ git clone https://gitee.com/mrxlh/interview.git --recursive
Cloning into 'interview'...
remote: Enumerating objects: 89, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 89 (delta 1), reused 0 (delta 0), pack-reused 84
Receiving objects: 100% (89/89), 235.59 MiB | 461.00 KiB/s, done.
Resolving deltas: 100% (31/31), done.
Updating files: 100% (58/58), done.


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
6. 重新添加文件并推送到gitee
Administrator@LAPTOP-CQKSUP6R MINGW64 /d/open_source/Interview (master)
$ git add .
warning: adding embedded git repository: interview
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> interview
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached interview
hint:
hint: See "git help submodule" for more information.
    
Administrator@LAPTOP-CQKSUP6R MINGW64 /d/open_source/Interview (master)
$ git push
Everything up-to-date


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/760702
推荐阅读
相关标签
  

闽ICP备14008679号