There are several ways to delete a git configuration based on the scope of the configuration as shown below.
Delete git system configuration options:
Option 1: Directly edit the git config file:
1 2 3 4 5 6 7 |
## Execute below command to open your git system config file in default editor git config --system --edit ## Delete the configuration section or items and save the file ## Check if system config was deleted successfully git config --system --list |
Option 2: Delete the entire configuration section:
1 2 3 4 5 6 7 8 |
## Delete entire configuration section git config --system --remove-section ## for example to delete your git user.name and user.email on system configuration git config --system --remove-section user ## Check if system config was deleted successfully git config --system --list |
Option 3: Delete individual configuration items:
1 2 3 4 5 6 7 8 9 |
## Delete individual git config git config --system --unset ## for example to delete your git user.name and user.email on system configuration git config --system --unset user.name git config --system --unset user.email ## Check if system config was deleted successfully git config --system --list |
Delete git global configuration options:
Option 1: Directly edit the git config file:
1 2 3 4 5 6 7 |
## Execute below command to open your git global config file in default editor git config --global --edit ## Delete the configuration section or items and save the file ## Check if global config was deleted successfully git config --global --list |
Option 2: Delete the entire configuration section:
1 2 3 4 5 6 7 8 |
## Delete entire configuration section git config --global --remove-section ## for example to delete your git user.name and user.email on global configuration git config --global --remove-section user ## Check if global config was deleted successfully git config --global --list |
Option 3: Delete individual configuration items:
1 2 3 4 5 6 7 8 9 |
## Delete individual git config git config --global --unset ## for example to delete your git user.name and user.email on global configuration git config --global --unset user.name git config --global --unset user.email ## Check if global config was deleted successfully git config --global --list |
Delete git local configuration options:
Option 1: Directly edit the git config file:
1 2 3 4 5 6 7 |
## Execute below command to open your git local config file in default editor git config --local --edit ## Delete the configuration section or items and save the file ## Check if local config was deleted successfully git config --local --list |
Option 2: Delete the entire configuration section:
1 2 3 4 5 6 7 8 |
## Delete entire configuration section git config --local --remove-section ## for example to delete your git user.name and user.email on local configuration git config --local --remove-section user ## Check if local config was deleted successfully git config --local --list |
Option 3: Delete individual configuration items:
1 2 3 4 5 6 7 8 9 |
## Delete individual git config git config --local --unset ## for example to delete your git user.name and user.email on local configuration git config --local --unset user.name git config --local --unset user.email ## Check if local config was deleted successfully git config --local --list |