Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I've setup grep colors in my ~/.bashrc :

export GREP_COLORS='ms=01;34:mc=01;34:sl=:cx=:fn=35:ln=32:bn=32:se=36'

They work for

  • grep --color=auto
  • grep --color=always

Unfortunately, those custom colors are ignored by:

  • git grep --color=auto
  • git grep --color=always

How to make git grep to use above $GREP_COLORS colors ?

share|improve this question
Git doesn't call the external grep utility, it has its own internal command which is called git grep and has similar but not identical options. – Gilles Feb 2 '12 at 1:16

2 Answers 2

Git grep is not using the GREP_COLORS environment variable. Instead you should add custom entries in you ~/.gitconfig

For example:

[color "grep"]
    linenumber = yellow bold
    match = red
    filename = magenta     
share|improve this answer
How do you do background? – letitbee Aug 17 at 9:47

You should explicitly configure colors in git's configuration file.

Interesting information are found in git-config man page, in particular look for the configuration variable color.grep.<slot>

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.