【学了就忘】Git基础 — 11、配置Git用户签名方式

1、配置Git签名

(1)语法
$ git config 配置文件作用域 user.name '用户名'
$ git config 配置文件作用域 user.email '邮箱地址'

示例如下:

配置 user.name和user.email
$ git config --global user.name ‘your_name'
$ git config --global user.email ‘your_email@domain.com'

注意:这个email一定是有效的,是你能够收得到邮件的email。

(2)配置系统用户签名

可在任意目录下运行创建命令:git config --system

L@DESKTOP-T2AI2SU MINGW64 /j/git-repository/learngit
$ git config --system user.name 'tang_s'

L@DESKTOP-T2AI2SU MINGW64 /j/git-repository/learngit
$ git config --system user.email 'tang_s@126.com'

提示:在Git中,没有提示就是最好的提示。

系统用户注册信息会写在本地Git的安装目录下,...\etc\gitconfig文件中。

L@DESKTOP-T2AI2SU MINGW64 /j/git-repository/learngit
$ cat /f/DevInstall/Git/GitforWindows/etc/gitconfig
[diff "astextplain"]
        textconv = astextplain
[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true
[http]
        sslBackend = openssl
        sslCAInfo = F:/DevInstall/Git/GitforWindows/mingw64/ssl/certs/ca-bundle.crt
[core]
        autocrlf = true
        fscache = true
        symlinks = false
[credential]
        helper = manager
[user]
        name = tang_s
        email = tang_s@126.com

提示:之前的Git版本中,gitconfig文件是在,Git安装目录下mingw64目录中的etc/gitconfig

(3)配置全局用户签名

可在任意目录下运行创建命令:git config --global

# 在任何位置执行都可以
# 执行这个配置表示你这台机器上所有的Git仓库都会使用这个配置,
# 当然也可以对某个仓库指定不同的用户名和Email地址(本地用户)。
L@DESKTOP-T2AI2SU MINGW64 /j/git-repository/learngit
$ git config --global user.name 'sun_wk'

L@DESKTOP-T2AI2SU MINGW64 /j/git-repository/learngit
$ git config --global user.email 
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值