Remove git config at Local, Global or System Levels?


Remove a value from git config file

In order to remove a set value from git config file, you can make use of the --unset option along with the config command.

git config --unset [--local|--global|--system] value

Example:
# git config --list --show-origin
file:/etc/gitconfig     core.editor=nano -w
file:/home/neo/.gitconfig       user.email=you@example.com
file:/home/neo/.gitconfig       user.name=Neo
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        dev.name=Mike

Let us try to unset dev.name at the local level.

# git config --unset  --local dev.name
git config --list
core.editor=nano -w
user.email=you@example.com
user.name=Neo
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap