Home > Software engineering >  Git warning "encountered old-style '/home/user/.gitignore' that should be '%(pre
Git warning "encountered old-style '/home/user/.gitignore' that should be '%(pre

Time:02-08

Using git version 2.35.1.windows.2, all Git invocations include this warning at least once:

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'.
[...]

Sometimes multiple times:

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.

Which is confusing, because I'm on Windows and there's no .gitignore file in my home folder.

What is causing this warning?

CodePudding user response:

The user configuration file at ~/.gitconfig contained the following entry:

[core]
    excludesfile = /home/boppreh/.gitignore

So the problem is that I assumed the leading slash made the path absolute (it doesn't), and I transferred a .gitconfig file from a Linux machine without the matching .gitignore file.

My solution was to remove the offending line.

  •  Tags:  
  • Related