Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to unset a global git config section in a local git config file?

Tags:

git

My ~/.gitconfig contains this include section to inherit from a team-wide config file.

[include]
    ~/.gitconfig.team

However, I have personal repos where I don't want to inherit from this .gitconfig.team.

Is there a way I can override/force unset this section in my personal repos? E.g., something I can add to .git/config in personal_project/?

I'm interested in a solution where I modify configs in my personal repos instead of my team repos.

like image 690
stephjang Avatar asked Jan 23 '26 11:01

stephjang


1 Answers

No

Git config includes operate:

as if its contents had been found at the location of the include directive

ref

That means you can't override/remove the include itself, as as soon as it's found the contents of the included file are injected/loaded.

You can of course override the settings it contains in a more specific config file:

# ~/.git.config.team
[user]
    name = name

Locally, via git config user.name nic

# /some/project/.git/config
[user]
    name = alias

Yielding:

/some/project $ git config user.name
alias
/some/project $
like image 174
AD7six Avatar answered Jan 26 '26 01:01

AD7six