Git环境设置 - zbunix/building GitHub Wiki

  • git_config_env
$ cat /etc/profile.d/android.sh 
export JAVA_HOME=/opt/jdk1.6.0_25
export CLASSPATH=./:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/opt/arm-2010.09/bin:$PATH:.
export EDITOR="vim" 
git config --global user.name $USER
git config --global user.email [email protected]
  • git忽略掉文件权限检查
#old mode 100755 new mode 100644, 让git忽略掉文件权限检查
git config --global core.filemode false
  • 设置所有用户editor, Git用户名,邮件地址的缺省值
root@android-work1:/# cat /etc/profile.d/nwd.sh 
export EDITOR="vim"
git config --global user.name $USER
git config --global user.email [email protected]
  • 查看当前用户git全局环境变量
os-weizb@android-work1:~$ git config -l
user.name=os-weizb
[email protected]
  • 修改git commit后用vim编辑 git config --global core.editor vim global修改的是~/.gitconfig,对当前用户有效
  • 设置 Git 的用户名及邮件地址
$ git config --global user.name [username]
$ git config --global user.email [email]

没有配置用户名的时候git报错信息
[master 1861d1a] SomeDocuments
 Committer: Neten 
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
 
    git config --global user.name "Your Name"
    git config --global user.email [email protected]
 
After doing this, you may fix the identity used for this commit with:
 
    git commit --amend --reset-author
 
 1580 files changed, 205989 insertions(+), 0 deletions(-)
  • 查看当前用户git配置
os-weizb@android-work1:~/android/SDK2308$ git config -l
user.name=os-weizb
[email protected]
core.filemode=false
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
[email protected]:SDK2308.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
⚠️ **GitHub.com Fallback** ⚠️