好好生活
  平平淡淡每一天

编辑

Git 配置用户名与邮箱

1.用户名和邮箱地址的作用

用户名和邮箱地址是本地git客户端的一个变量。

每次commit都会用用户名和邮箱纪录。

github的contributions统计就是按邮箱来统计的。

2.查看用户名和邮箱地址

git config --list

或者

git config user.name

git config user.email

3.修改用户名和邮箱地址

git config --global user.name "mjtabu"

git config --global user.email "mjtabu.email.com"

git config --global user.user "mjtabu"

4.查看配置文件的位置

Git会优先使用库级别的配置,再然后是global级别的配置,最后是system级别的配置.

位置1:/etc/gitconfig

系统级别的配置,适用于所有的用户和所有的库,可以使用 $git config --system 来指定和修改,存储在Git安装目录下

内容参考

[http]
	sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
	sslBackend = openssl
[diff "astextplain"]
	textconv =astextplain
[filter "lfs"]
	clean = git-lfs clean --%f
	smudge = git-lfs smudge --%f
	required = true
	process = git-lfs filter-process
[core]
	autocrlf=true
	fscache =true
	symlinks = false
[user]
	name = mitabu
	email = mitabu.email.com
[credential]
	helper = store

位置2:gitconfig

用户级别的配置,适用于当前登录的用户,可以使用$git config --gloabal来指定和修改,存储在C:\Documents and Settings$USER下
若是everything搜索,则找包含'Git/etc'路径的那个

内容参考

[user]
	name= mitabu
	email= mjtabu.email.com
[credential]
	helper=store

位置3:.git/config

库级别的配置,适用于某个具体的库,可以使用$git config来指定和修改,存储在具体的库隐藏的.git文件夹下

posted @ 2021-02-07 15:46  踏步  阅读(2071)  评论(0)    收藏  举报