网址:https://git-scm.com/book/zh/v2/起步-安装-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