I’d like to change the language of git (to English) in my Linux installation without changing the language for other programs and couldn’t find the settings. How to do it?
-
2You're looking to change locale. I'd repost that question on superuser I think. – JosefAssad May 17 '12 at 10:27
8 Answers
Add these lines to your ~/.bashrc
, ~/.bash_profile
or ~/.zprofile
to force git to display all messages in English:
# Set Git language to English
#alias git='LANG=en_US git'
alias git='LANG=en_GB git'
The alias needs to override LC_ALL
on some systems, when the environment variable LC_ALL
is set, which has precedence over LANG
. See the UNIX Specification - Environment Variables for further explanation.
# Set Git language to English
#alias git='LC_ALL=en_US git'
alias git='LC_ALL=en_GB git'
In case you added these lines to ~/.bashrc
the alias will be defined when a new interactive shell gets started. In case you added it to ~/.bash_profile
the alias will be applied when logging in.

- 14,011
- 7
- 48
- 66
-
There was a typo in the file name (`.bash.rc` instead of `.bashrc`). You also have to close and start the shell again for the `.bashrc` to be executed. I added an note on this, as well. – Bengt Jun 04 '12 at 20:33
-
I tried it in my `.bashrc` even with restarting. Aliases work. It´s just the language doesn´t change. – user905686 Jun 09 '12 at 15:33
-
To verify that the `.bashrc` gets executed successfully you could add an test like `echo "This is .bashrc"`to the end of the file. You can also get have it executed on demand without having to restart the terminal or the whole system by `. .bashrc`. Finally, I would suggest trying to set the `LC_ALL` environment variable instead of `LANG`, since the first one has precedence. – Bengt Jun 10 '12 at 16:16
-
Everything is fine with my `.bashrc`, really. If `LC_ALL` has precedence then this will be the problem, it is set to my language. But then I don´t want to change the general language setting... Can´t I overwrite it for one program? – user905686 Jun 10 '12 at 17:40
-
1You can set the language using the suggested method without side effects, since these variables only life as long as the command takes to terminate. Try it by running `$ LC_ALL="en_US" man` and then `$ man` – Bengt Jun 10 '12 at 23:58
-
Ok, `alias git='LC_ALL="en_US" git'` works! Would you please extend your answer to include both cases with explanation? – user905686 Jun 14 '12 at 10:16
-
Glad I could finally help you, I extended my answer accordingly. I guess I have just owned my first acceptance, am I right? – Bengt Jun 14 '12 at 23:46
-
Yes. But the problem lines in my `.bashrc` were `export LANG="
.UTF-8"` and `export LC_ALL=" – user905686 Jun 15 '12 at 14:13.UTF-8"`. So the corresponding one should be overwritten, `LANG` when only `LANG` is set and `LC_ALL` when `LC_ALL` or others are set if I am right. -
Git started to speak French after upgrading to Ubuntu 13.10. Setting LANG solved the issue, LC_ALL was unset. – Maxime R. Nov 04 '13 at 08:59
-
-
@OliverWatkins `.bashrc` and `.bash_profile` are located in the home directory. When you open a terminal, you usually are there already. Alternatively, you can do a `cd ~` or `cd $HOME` to get there. I have edited my answer to include `~/` prefixes. – Bengt Nov 27 '14 at 15:16
-
In case you are using Z shell (zsh) you need to set your language environment to your `~/.zshrc` – benedikt Oct 28 '19 at 15:35
-
@benedikt The question is about only changing the language of only git. If zsh can do that, that should be an answer, not a comment. – Bengt Oct 28 '19 at 19:31
If you just want to have one command in english instead you can just write LC_ALL=C
before the command, for example:
LC_ALL=C git status
will result in
# On branch master
nothing to commit, working directory clean
The locale as used in C
is English and always available without installing additional language packs
(see https://askubuntu.com/a/142814/34298)
To change it for the whole current bash session just enter
LANG=C
To change it for example to german enter
LANG=de_DE.UTF-8
-
Thanks for the `LC_ALL=C` suggestion, as I have some problems with locale, `LC_ALL="en_US"` didn´t work anymore recently. – user905686 Apr 27 '14 at 16:20
Adding this line solved the problem for me: Update: it seems like more components require a Locale as well now.
$ more ~/.bash_profile
export LANG=en_US (obsolete)
export LANG="en_US.UTF-8" (Updated)

- 476
- 3
- 12
-
3The question is how to change the language for git only - I updated it to be more clear. – user905686 Jan 18 '19 at 10:03
-
Note: since Git 2.3.1+ (Q1/Q2 2015), Git will add Accept-Language header if possible.
See commit f18604b by Yi EungJun (eungjun-yi
)
Add an
Accept-Language
header which indicates the user's preferred languages defined by$LANGUAGE
,$LC_ALL
,$LC_MESSAGES
and$LANG
.This gives git servers a chance to display remote error messages in the user's preferred language.
You have locale for git gui or other GUIs, but not for the command-line, considering it was one of the questions of GitSurvey 2010
localization of command-line messages (i18n) 258 3.6%
Of course, since 2010, as po/README
describes:
Before strings can be translated they first have to be marked for translation.
Git uses an internationalization interface that wraps the system's
gettext
library, so most of the advice in your gettext documentation (on GNU systemsinfo gettext
in a terminal) applies.
In place since git 1.7.9+ (January 2012):
Git uses
gettext
to translate its most common interface messages into the user's language if translations are available and the locale is appropriately set.
Distributors can drop newPO
files inpo/
to add new translations.
So, if your update has mess up the translation, check what gettext
uses:
See, for instance, "Locale Environment Variables"
A locale is composed of several locale categories, see Aspects. When a program looks up locale dependent values, it does this according to the following environment variables, in priority order:
LANGUAGE LC_ALL LC_xxx, according to selected locale category: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, ... LANG
Variables whose value is set but is empty are ignored in this lookup.
LANG
is the normal environment variable for specifying a locale. As a user, you normally set this variable (unless some of the other variables have already been set by the system, in/etc/profile
or similar initialization files).
LC_CTYPE
,LC_NUMERIC
,LC_TIME
,LC_COLLATE
,LC_MONETARY
,LC_MESSAGES
, and so on, are the environment variables meant to overrideLANG
and affecting a single locale category only.
For example, assume you are a Swedish user in Spain, and you want your programs to handle numbers and dates according to Spanish conventions, and only the messages should be in Swedish. Then you could create a locale named ‘sv_ES
’ or ‘sv_ES.UTF-8
’ by use of thelocaledef
program. But it is simpler, and achieves the same effect, to set theLANG
variable toes_ES.UTF-8
and theLC_MESSAGES
variable tosv_SE.UTF-8
; these two locales come already preinstalled with the operating system.
LC_ALL
is an environment variable that overrides all of these. It is typically used in scripts that run particular programs. For example, configure scripts generated by GNUautoconf
useLC_ALL
to make sure that the configuration tests don't operate in locale dependent ways.Some systems, unfortunately, set
LC_ALL
in/etc/profile
or in similar initialization files. As a user, you therefore have to unset this variable if you want to setLANG
and optionally some of the otherLC_xxx
variables.
Earlier, HTTP transport clients learned to tell the server side what locale they are in by sending Accept-Language
HTTP header, but this was done only for some requests but not others.
This is fixed with Git 2.38 (Q3 2022):
See commit b0c4adc (11 Jul 2022) by Li Linchao (Cactusinhand
).
(Merged by Junio C Hamano -- gitster
-- in commit 4b8cdff, 19 Jul 2022)
remote-curl
: send Accept-Language header to serverHelped-by: Junio C Hamano
Signed-off-by: Li Linchao
Git server end's ability to accept
Accept-Language
header was introduced in f18604b ("http
: add Accept-Language header if possible", 2015-01-28, Git v2.4.0-rc0 -- merge), but this is only used by very early phase of the transfer, which is HTTPGET
request to discover references.
For other phases, likePOST
request in the smart HTTP, the server does not know what language the client speaks.Teach git client to learn end-users preferred language and throw
accept-language
header to the server side.
Once the server gets this header, it has the ability to talk to end-user with language they understand.
This would be very helpful for many non-English speakers.

- 1,262,500
- 529
- 4,410
- 5,250
-
1So where does the transalation come from? The reason why I asked is that I had git in english before and after an update it changed to my language, but I don´t like this. – user905686 May 19 '12 at 16:01
-
@user905686 sorry, my mistake. Git supports locale, with gettext. So check out your environment variables. I detail which one to check in my edited answer. – VonC May 19 '12 at 16:29
-
What if I want to just change the language for git but not for other programs? I.e. for me translations break some things so I would like to have git *always* (no matter which program calls it) have LANG=C and everything else in my native language. Any ideas? – Droggl May 29 '12 at 12:09
-
@Droggl As long as you set `LANG` in the bash/shell/DOS session you are using `git` in (or launching `git-gui` from), only `git` (or `git-gui`) will be using that specific setting. All the other programs will inherit from the system / user environment variables. – VonC May 29 '12 at 13:17
Run LC_MESSAGES=C git
, not LC_ALL=C or LANG=C and no need delete or rename files.
This command change output Git messages to english.

- 199
- 2
- 3
GIT defaults to english if it cannot find the Locale language.
So if you want GIT to be in english, just sabotage the language file that it is running with. In my case it was always running with german (ie: de.msg).
If I deleted it or renamed the it, then it defaulted to english.
Here I renamed the file

- 12,575
- 33
- 119
- 225
-
With Git for Windows 2.x (64 bit) this will be in `C:\Program Files\Git\mingw64\share\locale\$LANG\LC_MESSAGES\git.mo`. – Koraktor May 28 '15 at 08:25
-
The advantage of this approach might be that after an update of git, the translation will be back (and maybe improved), so you can decide again whether you want to use it or remove it again. – user905686 Jan 18 '19 at 10:01
-
I've checked the source code, it seems that git does not support English: https://github.com/git-l10n/git-po/tree/master/po Even I want to use English first before Chinese and Swedish (en_GB:en:zh_HK:zh_CN:zh:sv_SE:sv), git still shows Chinese to me. – Michael Tsang Mar 07 '19 at 08:17
-
On Mac OSx with Git installed via Homebrew, I found the locales in `/usr/local/Cellar/git/2.21.0/share/locale/`. – Magnus Jul 02 '19 at 19:21
As Bengt suggested : Add these lines to your ~/.bashrc
or ~/.bash_profile
to force git to display all messages in English:
vim ~/.bashrc
- for this profile (if you are user ubuntu
and you edit this it will be only for this user);
add this lines:
# Set Git language to English
#alias git='LANG=en_US git'
alias git='LANG=en_GB git'
#you can add also
LANG=en_GB
and after you close the file you need to write in shell:
source ~/.bashrc
to reload new settings or exit the terminal and connect again :)

- 127
- 1
- 3
-
What is the additional `LANG=en_GB` in `~/.bashrc` supposed to do? Doesn't that just define the local variable `LANG`? – user905686 May 30 '19 at 10:56
Here is my solution to change git language follow answer this and this
1) nano ~/.bashrc
2) add alias git='LANG=en_GB git'
to the file
2) save the file
4) source ~/.bashrc
Now your git already change the language. However, IF after your restart terminal and it not working anymore, you need to
4.1) nano ~/.profile
4.2) add source ~/.bashrc
4.3) save the file
it will make source ~/.bashrc
run whenever you open the terminal
Hope it help

- 57,942
- 23
- 262
- 279