git pull 时本地字符集错误

在运行git pull 等命令时,有时会出现如下情况: 

$ git pull 
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.UTF-8) 
perl: warning: Setting locale failed. 
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset), 
LC_ALL = "zh_CN.UTF-8", 
LC_PAPER = "zh_CN.UTF-8", 
LC_ADDRESS = "zh_CN.UTF-8", 
LC_MONETARY = "zh_CN.UTF-8", 
LC_NUMERIC = "zh_CN.UTF-8", 
LC_TELEPHONE = "zh_CN.UTF-8", 
LC_IDENTIFICATION = "zh_CN.UTF-8", 
LC_MEASUREMENT = "zh_CN.UTF-8", 
LC_TIME = "zh_CN.UTF-8", 
LC_NAME = "zh_CN.UTF-8", 
LANG = "ja_JP.UTF-8" are supported and installed on your system. 
perl: warning: Falling back to the standard locale ("C"). 

 出现这种情况,在~/.bashrc文件最后追加

export LANGUAGE=en_US.UTF-8 
export LANG=en_US.UTF-8 
export LC_ALL=en_US.UTF-8

然后 

source ~/.bashrc 

最后执行 

locale-gen en_US.UTF-8 
sudo dpkg-reconfigure locales 

即可解决。 


参考: http://hi.baidu.com/pie138/item/99fb4abc4b206e462aebe308 

http://www.thomas-krenn.com/en/wiki/Perl_warning_Setting_locale_failed_in_Debian

你可能感兴趣的:(git)