4

I want to remove a filter that added to Git. The command git config --list shows the filter I added

filter.spabs.clean=expand --initial -t 4
filter.spabs.smudge=expand --initial -t 4
filter.spabs.required

How can I remove it? Where does Git store the filters? I have verified .gitconfig and I don't have a .git/info/attributes file.

Hunsu
  • 3,281
  • 7
  • 29
  • 64
  • If those entries are absent from your `~/.gitconfig` file, look for them in the `.git/config` file of your repo; delete whichever entry(ies) you want. – jub0bs Sep 11 '15 at 08:26
  • @Jubobs I done that but I got the same result when I do `git config --list` – Hunsu Sep 11 '15 at 08:54
  • Have you deleted the offending entries from your `.git/config` file and saved the file? – jub0bs Sep 11 '15 at 08:55
  • @Jubobs Yes I deleted all the filter section. – Hunsu Sep 11 '15 at 09:00
  • As Frederic points out in his answer, the offending line may be in the global (i.e. user-level) Git config file, which is usually `~/.gitconfig`; run `git config --list --global` to check whether they're indeed in that file. Or they may be in the system-wide Git config file; run `git config --list --system` to check. – jub0bs Sep 11 '15 at 09:03
  • @Jubobs they are in the system-wide – Hunsu Sep 11 '15 at 09:13
  • then you should be able to remove from the ~/.gitconfig file – Frederic Henri Sep 11 '15 at 10:08
  • @FredericHenri My system-wide config file is on /etc folder. – Hunsu Sep 11 '15 at 10:13

2 Answers2

6

For removing in all config files (without having to look for the key):

git config --unset-all filter.spabs.clean
git config --unset-all filter.spabs.smudge
git config --unset-all filter.spabs.required

As illustrated in "git credential.helper=cache never forgets the password?", you can do a:

sudo git config --system --unset-all filter.spabs.clean
sudo git config --system --unset-all filter.spabs.smudge
sudo git config --system --unset-all filter.spabs.required

That would remove those keys from /etc/gitconfig.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

so you need to know where they are defined, rather than git config --list you can run the 2 commands

git config --local --list
git config --global --list

For local filters, you need to look under .git/config file

For global filters, you need to look under ~/.gitconfig file

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139