Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@Sudhakarp1244 Sudhakarp1244 commented Mar 2, 2018

NIce Post

@umarfarooq21

This comment has been minimized.

Copy link

@umarfarooq21 umarfarooq21 commented Apr 13, 2018

good information

@saurjain108

This comment has been minimized.

Copy link

@saurjain108 saurjain108 commented Apr 25, 2018

awesome

@Cvetomird91

This comment has been minimized.

Copy link

@Cvetomird91 Cvetomird91 commented Apr 26, 2018

Thank you. :)

@beingKHUSH

This comment has been minimized.

Copy link

@beingKHUSH beingKHUSH commented Jun 7, 2018

Very well explained :)

@JackZylkin

This comment has been minimized.

Copy link

@JackZylkin JackZylkin commented Jun 25, 2019

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

This comment has been minimized.

Copy link

@1oglop1 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

This comment has been minimized.

Copy link

@dvasilen dvasilen commented Nov 5, 2019

Thanks

@BarbzYHOOL

This comment has been minimized.

Copy link

@BarbzYHOOL BarbzYHOOL commented Dec 13, 2019

very useful, thank you

@mgjam

This comment has been minimized.

Copy link

@mgjam mgjam commented Jan 19, 2021

Thanks for the summary ❤️

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