使用git版本2.35.1.windows.2,所有Git调用至少包括一次此警告:
PS C:\Users\BoppreH\Desktop\source\keyboard> git status
warning: encountered old-style '/home/boppreh/.gitignore' that should be '%(prefix)/home/boppreh/.gitignore'
On branch new_core
Your branch is up to date with 'origin/new_core'.
[...]
有时多次:
PS C:\Users\BoppreH\Desktop\source\keyboard> git pull
warning: encountered old-style '/home/boppreh/.gitignore' that should be '%(prefix)/home/boppreh/.gitignore'
warning: encountered old-style '/home/boppreh/.gitignore' that should be '%(prefix)/home/boppreh/.gitignore'
warning: encountered old-style '/home/boppreh/.gitignore' that should be '%(prefix)/home/boppreh/.gitignore'
warning: encountered old-style '/home/boppreh/.gitignore' that should be '%(prefix)/home/boppreh/.gitignore'
warning: encountered old-style '/home/boppreh/.gitignore' that should be '%(prefix)/home/boppreh/.gitignore'
Already up to date.
这是令人困惑的,因为我在Windows上,而且我的主文件夹中没有.gitignore
文件。
是什么引起了这个警告?
发布于 2022-04-18 15:05:28
对于最新的git
发布版本,建议在任何根文件上预置%(prefix)
引用。
否则,您将得到您所指的警告。获得它的次数取决于正在运行的git
命令。它有效地反映了解析.gitconfig
文件中此类引用的次数。
我相信如果您按以下方式更新违规行,您将不会收到警告信息。
[core]
excludesfile = %(prefix)/home/boppreh/.gitignore
顺便说一下,在使用(WSL)时,发布了一个与Git for Windows v2.35.3相关的bug修复程序。
如果添加前缀,并且仍然收到警告,则可能与您的情况有关。
发布于 2022-02-05 14:17:37
~/.gitconfig
上的用户配置文件包含以下条目:
[core]
excludesfile = /home/boppreh/.gitignore
所以问题是,我假设前面的斜杠使路径是绝对的(它没有),并且我在没有匹配的.gitconfig文件的情况下从Linux机器传输了一个.gitignore文件。
我的解决办法是移除冒犯的界限。
发布于 2022-08-26 05:30:27
文件名中的一个简单的~
为我解决了这个问题,它在Windows上的工作带来了额外的好处。
[core]
excludesfile = ~/.gitignore
警告应该消失了。
https://stackoverflow.com/questions/70998844
复制相似问题