Skip to content

Instantly share code, notes, and snippets.

@lifuzu
Created March 11, 2014 17:09
Show Gist options
  • Star 42 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save lifuzu/9490352 to your computer and use it in GitHub Desktop.
Save lifuzu/9490352 to your computer and use it in GitHub Desktop.
Three levels of GIT config
# There are 3 levels of git config; project, global and system.
# project: Project configs are only available for the current project and stored in .git/config in the project's directory.
# global: Global configs are available for all projects for the current user and stored in ~/.gitconfig.
# system: System configs are available for all the users/projects and stored in /etc/gitconfig.
# Create a project specific config, you have to execute this under the project's directory.
$ git config user.name "John Doe"
# Create a global config
$ git config --global user.name "John Doe"
# Create a system config
$ git config --system user.name "John Doe"
@Sudhakarp1244
Copy link

NIce Post

@umarfarooq21
Copy link

good information

@saurjain108
Copy link

awesome

@Cvetomird91
Copy link

Thank you. :)

@beingKHUSH
Copy link

Very well explained :)

@JackZylkin
Copy link

I don't think this is an accurate depiction of how it works in Windows. I have a file called ProgramData/Git/config that defines neither the system nor the global git config settings, yet is picked up by the git config -l command,

Not sure why.

@1oglop1
Copy link

1oglop1 commented Sep 30, 2019

Good point @JackZylkin
Just for the sake of completeness let me add SO thread https://stackoverflow.com/a/32849199.
One can also verify where the config is coming from by using git config -l --show-origin

@dvasilen
Copy link

dvasilen commented Nov 5, 2019

Thanks

@BarbzYHOOL
Copy link

very useful, thank you

@mgjam
Copy link

mgjam commented Jan 19, 2021

Thanks for the summary ❤️

@davidkirwan
Copy link

TIL. Thanks!

@hishamls
Copy link

Thank You!

@SaifFGit
Copy link

SaifFGit commented Jun 4, 2022

Thanks!

@FrancoisHub
Copy link

FrancoisHub commented Aug 21, 2023

For helping Windows users:

  • project: Project configs are only available for the current project and stored in .git/config in the project's directory.
  • global: Global configs are available for all projects for the current user and stored in the user's folder: C:/Users//.gitconfig.
  • system: System configs are available for all the users/projects and stored where Git is installed which is by default C:/Program Files/Git/etc/gitconfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment