全局配置
git config --global user.name "leo"
git config --global user.email "leo***cn"
C:\Users\用户名\.gitconfig 文件
[core]
autocrlf = true
excludesfile = C:\\Users\\lixinglong\\Documents\\gitignore_global.txt
[user]
name = leo
email = leo@***.cn
根据项目配置
git config user.name "leo"
git config user.email "leo***cn"
对应的本地仓库的.git文件中的config文件
在当前项目目录下使用 cat .git/config,就可以看到配置文件内容
PS E:\dream> cat .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://github.com/***/***.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
配置记住密码
[core]
autocrlf = true
excludesfile = C:\\Users\\lixinglong\\Documents\\gitignore_global.txt
[user]
name = leo
email = leo@***.cn
[credential]
helper = store // 这样配置就会记住密码了
git
$ git config --global --list
$ git config --global user.name hoby
$ git config --global alias.br branch
$ git config --unset alias.co
$ git config --global core.ignorecase false
具体配置可参考如下,其中:
【user】: 用户提交时显示在log里的信息
【alias】: 常用git命令简写
【core】: window系统和类linux系统回车键转换
【push】: 默认对应远端(当本地分支名与远程分支名不一致有用)
git config 解析
[email protected]
user.name=leo
core.ignorecase=false
core.autocrlf=input
core.filemode=false
core.safecrlf=true
core.editor=vim
core.repositoryformatversion=0
core.bare=false
core.logallrefupdates=true
core.precomposeunicode=true
push.default=simple
alias.lg=log
pull.rebase=true
credential.helper store
git config
git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config
sudo git config credential.helper store