(20210301未解决)error: chmod on /path/.git/config.lock failed: Operation not permitted

  • Overview

    如题error: chmod on /path/.git/config.lock failed: Operation not permitted

  • 问题分析

    From R1, the reason is :

    The linux command chmod is not supported by NTFS.

    Solution which it suggest is :

    mkdir -p /home/user/.gitconfigs/myrepo
    ln -s /home/user/.gitconfigs/myrepo .git
    

    Proceed as before with “git init

    R2描述的意思其实也差不多,主要就是文件系统导致的问题。

    但是这个方法又出现运行ln命令时not permitted,总归是wsl2的挂载路径权限问题。

    我在WSL2中其他挂载的路径(电脑本机文件系统/mnt/f)上git init是成功的;出错的是网络硬盘挂载路径(/mnt/g)。

    R4提供的多种方案,都是针对本地计算机硬件磁盘可行,对于网络磁盘都是无效的。

  • 查看磁盘性质

    $ mount -l # 查看所有挂载路径
    F:\ on /mnt/f type 9p (~,trans=fd,rfd=8,wfd=8)
    G: on /mnt/g type 9p (~,trans=fd,rfd=3,wfd=3)
    

    可见区别如下两项。

  • naotime vs. relatime
  • rfd vs. wfd
  • References

  1. Creating git repo on NTFS in Linux
  2. WSL 2: chmod on […]/.git/config.lock failed: Operation not permitted #6284
  3. Chmod/Chown WSL Improvements
  4. WSL Ubuntu Distro | How to solve Operation not permitted on cloning repository

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/114434655