Git 本地与全局配置笔记
tools
阅读时长: 1 分钟
配置用户名,颜色
1
2
3
|
git config --global user.name "you_name" # 设置全局用户名
git config --global user.email "user@example.com" # 设置全局邮箱
git config --global color.ui true # 设置全局颜色显示
|
git 相关配置
https://zhuanlan.zhihu.com/p/133706032
配置全局
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# git config --global alias.confg 'config --global' # 目前看似乎没有生效
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.br branch
git config --global alias.unstage 'reset HEAD'
git config --global alias.last 'log -1'
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global core.quotepath false # vscode git status/commit 乱码
# 全局忽略 .DS_Store 文件
# specify a global exclusion list
git config --global core.excludesfile ~/.gitignore
# adding .DS_Store to that list
echo .DS_Store >> ~/.gitignore
|
配置针对当前仓库
1
2
|
git config alias.st status
git config alias.co checkout
|
生成ssh-key generate
1
|
ssh-keygen -t rsa -C 'company name'
|
本地配置
1
2
|
git config --local user.name "cxx"
git config --local user.email "sxx"
|