Git # 如何安装Git与配置最小单元(username、useremail)

网址:https://git-scm.com/book/zh/v2/起步-安装-Git 

Git - 安装 Git

相信有很多人通过官网在下载git的时候发现网速只有几十K,淘宝有一个镜像的网站 可以提供下载
https://npm.taobao.org/mirrors/git-for-windows/

已经完成Git安装,如何查看是否已经安装成功,Windows+R 打开命令窗口 运行cmd

git --version

现在进行Git的最小配置

在使用git前需要对git做最小配置。也就是需要配置user.name和user.email
如果不做最小配置,git是无法使用的。

最小配置单元

 $ git config --global user.name ‘your_name’ 
 $ git config --global user.email ‘your_email@domain.com’
  • 上述的global表示对登录用户的所有仓库有效
  • your_name可以设置为自己喜欢的名字
  • your_email@domain.com可以设置为自己的邮箱

git config的其它作用域

上面是配置的global域,config还有其他作用域:

$ git config --local         local只对仓库有效。此也为缺省条件下的配置
$ git config --global        global对登录用户的所有仓库都有效
$ git config --system        system对系统的所有用户都有效

 当你设置好config的配置后,如果想查看配置信息,加

--list

即可。如下:

查询最小单元的配置信息

$ git config --list --local
$ git config --list --global
$ git config --list --system

 如果想清楚config配置,使用

--unset

。如下:

$ git config --unset --local user.name
$ git config --unset --global user.name
$ git config --unset --system user.name

上面三个作用域是由一定的优先级的

local > global > system

总结:

  • 学会Git的最小配置

  • git config [–local | --global | --system] user.name ‘Your name’
    git config [–local | --global | --system] user.email ‘Your email’

    查看配置


参考文章:

【Git、GitHub、GitLab】一 Git安装与Git最小配置 - 「dt猫」 http://www.luyixian.cn/news_show_9816.aspx

Window下的git配置文件在哪里【图文】-百度经验 https://jingyan.baidu.com/article/870c6fc3589f22b03fe4be95.html

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值