Skip to content

Instantly share code, notes, and snippets.

@henryhu712
Last active March 27, 2016 22:03
Show Gist options
  • Save henryhu712/2250ef5082c990de23b8 to your computer and use it in GitHub Desktop.
Save henryhu712/2250ef5082c990de23b8 to your computer and use it in GitHub Desktop.
git config

How many config files for git?

There are 3 places where we can set git config:

  • /etc/gitconfig

This is globe config. Write and read its settings:

git config --system ...
  • $HOME/.gitconfig or $HOME/.config/git/config

This config is for current user.

git config --global ...
  • .git/config

This config is just for current repository. You can run the following command under a repository:

git config ...

For example, we usually set after install git as follows:

git config --global user.name "Henry"
git config --global user.email "henryhu712@gmail.com"

Check config

Check one config:

git config user.name
Henry

Check all config:

git config --list
alias.ci=commit
user.name=Henry
user.email=henryhu712@gmail.com
alias.st=status
alias.ci=commit
color.ui=true
push.default=simple
core.editor=vi
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:henryhu712/zdoc.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment