Я получаю эту ошибку между двумя системами W10, использующими VPN и RDP.
В моей локальной системе "My
" есть область c:\cap2office
, которая является репозиторием Git.
В удаленной системе "Remote" диск My 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 status», я все равно получаю:
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 программных файлов.
What should
%prefix
be, maybe the drive mapping doesn't work?
На самом деле, поскольку я подробно здесь, вы должны использовать настоящую строку %(prefix)
The value of this setting is interpolated, i.e.
~/<path>
expands to a path relative to the home directory and%(prefix)/<path>
expands to a path relative to Git's (runtime) prefix.
А также:
I'm curious where the .gitconfig file is located.
Сделайте git config --show-scope --show-origin -l
: вы увидите все файлы конфигурации и их пути.