如何更改 Git 命令行界面的语言? [英] How does one change the language of the command line interface of Git?

查看:28
本文介绍了如何更改 Git 命令行界面的语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 Linux 安装中更改 git 的语言(改为英语),而不更改其他程序的语言,但找不到设置.怎么做?

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?

推荐答案

将这些行添加到您的 ~/.bashrc~/.bash_profile~/.zprofile 强制git以英文显示所有消息:

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'

在某些系统上,当设置了环境变量LC_ALL时,别名需要覆盖LC_ALL,它优先于LANG.请参阅 UNIX 规范 - 环境变量 了解更多说明.

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'

如果您将这些行添加到 ~/.bashrc,则将在启动新的交互式 shell 时定义别名.如果您将其添加到 ~/.bash_profile,则登录时将应用别名.

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.

这篇关于如何更改 Git 命令行界面的语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆