search
Search
Publish
menu
menu search toc more_vert
Robocat
Guest 0reps
Thanks for the thanks!
close
Comments
Log in or sign up
Cancel
Post
account_circle
Profile
exit_to_app
Sign out
help Ask a question
Share on Twitter
search
keyboard_voice
close
Searching Tips
Search for a recipe: "Creating a table in MySQL"
Search for an API documentation: "@append"
Search for code: "!dataframe"
Apply a tag filter: "#python"
Useful Shortcuts
/ to open search panel
Esc to close search panel
to navigate between search results
d to clear all current filters
Enter to expand content preview
icon_star
Doc Search
icon_star
Code Search Beta
SORRY NOTHING FOUND!
mic
Start speaking...
Voice search is only supported in Safari and Chrome.
Navigate to
A
A
share
thumb_up_alt
bookmark
arrow_backShare
Twitter
Facebook
thumb_up
0
thumb_down
0
chat_bubble_outline
0
auto_stories new
settings

Git settings configuration

Software Development
chevron_right
Git
chevron_right
Common questions
schedule Mar 10, 2022
Last updated
local_offer
Tags

It is possible to check and change Git settings using the git config command.

There are three types of settings:

Type

Scope

Location

Notes

system

All repositories for every user on this computer.

/etc/gitconfig

-

global

All repositories of a particular user

~/.gitconfig

Directly below home

local

A specific repository

repository/.git/config

Under .git of the repository

Settings take precedence in the following order: local, global, system. For example, if the same setting is configured in both system and local, the value of local will be used.

You can view the list of all configurable settings from the official documentation: https://git-scm.com/docs/git-config.html#_variables

A few examples include:

  • color.ui: controls Git output color coding (set to auto by default)

  • core.editor: editor used for editing commit messages

Checking settings configuration

Single variable

You can check the current configuration for each variable using the following command:

git config <name>

where <name> refers to the name of the variable you would like to check the configuration for.

For example, to check the current configuration for the core.editor variable:

git config core.editor

To check the configuration at a particular level (local, system, global):

git config --local core.editor
git config --global core.editor
git config --system core.editor
NOTE

As local is a per repository setting, the --local option is only valid when the command is run within the repository.

All configured variables

To display all configured variables and their values that are enabled at the place where the command is executed:

git config -l
credential.helper=osxkeychain

Again, it is possible to just check the configurations at a particular level (local, system, global):

git config --local -l
git config --global -l
git config --system -l

Modifying settings configuration

To change the configuration of a particular variable:

git config <name> <value>

where:

  • <name> refers to the name of the variable you would like to check the configuration for

  • <value> refers to the new value to set for the variable

By default, running the above command will change the local configurations.

To change the global, system configurations of a particular variable:

git config --global <name> <value>
git config --system <name> <value>
robocat
Published by Arthur Yanagisawa
Edited by 0 others
Did you find this page useful?
thumb_up
thumb_down
Ask a question or leave a feedback...