我在运行VPN和RDP的两个W10系统之间出现了这个错误。我的本地系统"My“有一个区域c:\cap2office,它是一个Git存储库。
远程系统" remote“将我的C:驱动器映射到它的驱动器S:我可以在远程系统上看到C:\cap2office directory作为S:\cap2office。
而且远程系统上的用户名与本地系统上的用户名不同。
在远程上,我输入了"git status“,它抱怨所有权不匹配,并建议定义GIT_TEST_DEBUG_UNSAFE_DIRECTORIES=true,所以我在远程系统上这样做,警告就消失了。
但它仍然说:
warning: '//tsclient/C/cap2office' is on a file system that does not record ownership
fatal: unsafe repository ('//tsclient/C/cap2office' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory '%(prefix)///tsclient/C/cap2office'所以在远程系统上,我做到了:
git config --global --add safe.directory S:/cap2office在遥控器上,我可以做git config --list
除了错误(3次)外:
warning: '//tsclient/C/cap2office' is on a file system that does not record ownership
I see this at the end, so the safe.directory did get added:
safe.directory=S:/cap2office但是当我做“git状态”时,我仍然得到:
warning: '//tsclient/C/cap2office' is on a file system that does not record ownership
fatal: unsafe repository ('//tsclient/C/cap2office' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory '%(prefix)///tsclient/C/cap2office'所以我也试过
git config --global --add safe.directory //tsclient/C/cap2office
warning: '//tsclient/C/cap2office' is on a file system that does not record ownership
warning: encountered old-style '//tsclient/C/cap2office' that should be '%(prefix)///tsclient/C/cap2office'
fatal: unsafe repository ('//tsclient/C/cap2office' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory '%(prefix)///tsclient/C/cap2office'有什么想法吗?%prefix应该是什么,也许驱动器映射不起作用?
顺便说一句,我很好奇.gitconfig文件在哪里。
它似乎不是C:\user\accountname\.gitconfig的广告或程序文件的Git区域。
发布于 2022-07-17 00:25:30
%prefix应该是什么,也许驱动器映射不起作用?
实际上,作为我detailed here,您必须使用实际的字符串%(prefix)
此设置的值被内插,即
~/<path>扩展为相对于主目录的路径,and%(prefix)/<path>扩展为相对于Git的(运行时)前缀的路径。和:
我很好奇.gitconfig文件在哪里。
执行git config --show-scope --show-origin -l:您将看到所有配置文件及其路径。
https://stackoverflow.com/questions/73008213
复制相似问题