Skip to content

配置 ​


更新于 2024-05-14

git config ​

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

用户信息 ​

shell
# 配置全局用户信息
git config --global user.name "name"  
git config --global user.email name@example.com  
git config --global https.proxy https://your.proxy.server:port
# 编辑器全局配置
git config --global core.editor emacs


# 为特定仓库配置用户信息
cd path/to/code
git config user.name "name"  
git config user.email name@example.com  
git config https.proxy https://your.proxy.server:port
git config http.proxy https://your.proxy.server:port

# 为仓库保存密钥
git config credential.helper store
# 清空该仓库密钥
git config --unset credential.helper

检查配置信息 ​

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

获取帮助 ​

git help <verb>
git <verb> --help
man git-<verb>