Git基础配置参数

配置Git用户名和邮件:

1
2
git config --global user.name "your name"
git config --global user.email "your email"

对于其他参数讲解:

1
2
3
git config --local xxx xxx # 只针对某个仓库有效,如果切换到其他仓库则配置信息需重新设置
git config --global xx xxx # 对当前用户所有仓库有效
git config --system xx xxx # system参数对系统所有登录用户有效

要查看config配置,加--list

1
2
3
git config --list --local
git config --list --global
git config --list --system
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 WhiteCookies@LAPTOP-VGIQAEFL   base  G:  code  mygitea  test   master ≣ +1 ~0 -0 !  git config --list --global
user.email=GitHub 1961663351@qq.com
user.name=GitHub Whiteco-okie
http.sslverify=true
WhiteCookies@LAPTOP-VGIQAEFL   base  G:  code  mygitea  test   master ≣ +1 ~0 -0 !  git config --list --global git config --list --local core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=https://gitea.everweekup.com/Jabari/test.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
WhiteCookies@LAPTOP-VGIQAEFL   base  G:  code  mygitea  test   master ≣ +1 ~0 -0 !  git config --list --system
http.sslcainfo=E:/git/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge --skip -- %f
filter.lfs.process=git-lfs filter-process --skip
filter.lfs.required=true
credential.helper=manager

修改配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 WhiteCookies@LAPTOP-VGIQAEFL   base  G:  code  mygitea  test   master ≣ +1 ~0 -0 !  git config --local user.email "innocenfox@gmail.com"
WhiteCookies@LAPTOP-VGIQAEFL   base  G:  code  mygitea  test   master ≣ +1 ~0 -0 !  git config --local user.name "Jabari"

WhiteCookies@LAPTOP-VGIQAEFL   base  G:  code  mygitea  test   master ≣ +1 ~0 -0 !  git config --list --local core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=https://gitea.everweekup.com/Jabari/test.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
user.name=Jabari
user.email=innocenfox@gmail.com