bash 如何在mac中将git从中文改成英文

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14189134/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 04:11:04  来源:igfitidea点击:

How to change git from Chinese to English in mac

macosgitbash

提问by pktangyue

I remember I install git through port install git-core. And it show Chinese word as default like the followings:

我记得我是通过 .git 安装 git 的port install git-core。它默认显示中文单词,如下所示:

# 位于分支 master
# 您的分支领先 'origin/master' 共 2 个提交。
#
nothing to commit, working directory clean

and

# 位于分支 master
# 您的分支领先 'origin/master' 共 2 个提交。
#
# 尚未暂存以备提交的变更:
#   (使用 "git add <file>..." 更新要提交的内容)
#   (使用 "git checkout -- <file>..." 丢弃工作区的改动)
#
#   修改:      2.txt
#
no changes added to commit (use "git add" and/or "git commit -a")

I work on mac os with Chinese language, and I want to know how can just change git's language back to English.

我在 mac os 上使用中文,我想知道如何将 git 的语言改回英文。

回答by freestyler

export LC_ALL=en_US.UTF-8

export LC_ALL=en_US.UTF-8

Add it to your .bashrc or .zshrc file

将它添加到您的 .bashrc 或 .zshrc 文件中

回答by lidashuang

if you use fish shell

如果你使用鱼壳

~/.config/fish/config.fish

~/.config/fish/config.fish

set -x LC_ALL en_US.UTF-8
set -x LC_CTYPE en_US.UTF-8

回答by Oleksii Trekhleb

You may try to set LANGenvironment variable to en_US.UTF-8by adding the following line to your your ~/.bash_profilefile:

您可以尝试通过将以下行添加到您的文件来设置LANG环境变量:en_US.UTF-8~/.bash_profile

export LANG=en_US.UTF-8

It helped me to switch my Git language to English on macOS Mojave.

它帮助我在 macOS Mojave 上将我的 Git 语言切换为英语。

回答by kyb

To make it persistent in Fish:

要使其在 Fish 中持久化:

set --universal LC_ALL=en_US.UTF-8