Your prompt setting is incorrect, but not related at all to the git problem.
To make line editing work (i.e. to know where the cursor is after the prompt's printed), bash needs to know exactly how wide the prompt is. It cannot recognize every possible terminal-specific escape sequence out there, so it needs to be told explicitly that certain parts of the prompt are invisible; they have to be surrounded by \[
and \]
codes. For example:
PS1="\[\033[1;33m\]\u@\h: \w>\[\033[m\]"
Without doing this, typing a command longer than one line will very often result in the second line overwriting the first one, and other glitches.
However, none of this affects git. The reason git log
prints a ESC[33m
is because git itself wants that line to be shown in yellow – it always does so when the colour option, color.ui
, is enabled. The reason you see the word "ESC" instead of yellow is because your $PAGER doesn't recognize the sequence; it thinks you're reading a file with binary data (as opposed to human-readable text).
If you're using the default less
pager as $PAGER, it could be that you added some custom options to the $LESS
variable and forgot the one that allows colors, -R
. Normally git sets $LESS
internally when running a pager, but if you set that variable yourself git won't touch it and you have to add -R
to it:
export LESS="R"
export LESS="e M q R F X z -3"
...or something along those lines.
If you
export PS1
from bash prompt (not within.bashrc
), do you still get this error? – ssssteffff – 2014-04-23T15:29:45.550