Name and email address

Each commit you make has your name and email address attached to it. Git will automatically configure these based on your username and hostname, but this information is usually not a good identifier. It is a good idea to set your real name and email address so that your commits can be identified easily.

git config --global "Your Name"
git config --global

Global ignore file

Often there are files or directories that you want Git to ignore globally. These are probably created automatically by your IDE or operating system. Git’s core.excludesfile config allows you to write a global .gitignore so that you don’t have to fill local .gitignore files with clutter.

git config --global core.excludesfile /path/to/.gitignore_global

Enable coloured output

git config --global color.ui true

Prevent line ending issues

On Linux and Mac

git config --global core.autocrlf input

On Windows

git config --global core.autocrlf true

See for more information.

Add SVN-like shortcuts

git config --global status
git config --global commit
git config --global checkout
git config --global branch

Better compression

git config --global core.compression 9

If you find that Git is taking too long to compress objects, you can play around with this value. A value of 0 tells Git to use no compression. Values 1-9 are various speed/size trade-offs where 1 is the fastest and 9 provides the best compression. A value of -1 lets zlib decide which compression level to use.

Automatically rebase pulls

git config --global branch.autosetuprebase always

You can avoid having messy “Merge branch ‘master’ into …” commits by rebasing every time you pull. This configuration item essentially performs a git pull --rebase every time you do git pull.

Have any questions or comments? Feel free to reach out on Twitter: @Joseph_Wynn

This post was published on 28 August, 2011 and last updated on 24 July, 2016. It was posted in [Git] and tagged with [configuration, git, global]