fatal unsafe repository (‘ xx path ‘ is owned by someone else)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

3. 添加 safe.directory 并执行
Administrator@LAPTOP-CQKSUP6R MINGW64 /d/open_source/Interview
$ git config --global --add safe.directory D:\open_source\Interview

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

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.


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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

潇凝子潇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值