跳转至

配置


更新于 2024-05-14

git config

/etc/gitconfig 系统上每个用户及他们仓库的通用配置 --ststem
~/.gitconfig 针对当前用户 --global
~/.config/git/config
.git/cinfig 针对当前仓库
每一级别会覆盖上一级别的配置

用户信息

Bash
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 配置全局用户信息
git config --global user.name "name"  
git config --global user.email name@example.com  

# 为特定仓库配置用户信息
cd path/to/code
git config user.name "name"  
git config user.email name@example.com  

# 编辑器全局配置
git config --global core.editor emacs

检查配置信息

git config --list
检测单项配置
git config user.name

获取帮助

git help
git --help
man git-