玩转Git三剑客——02. 安装Git、03. 使用Git之前需要做的最小配置

学习视频:玩转Git三剑客(苏玲 携程代码平台负责人)——极客时间 https://time.geekbang.org

一、安装 

1. 打开Git中文官网:https://git-scm.com/book/zh/v2

2. 选择“1.5 起步 - 安装Git”,选择相应的系统版本,下载安装包并根据说明进行安装

3. 验证Git安装成功:打开终端,输入“git --version”

注:视频讲解为“在Mac上安装”

二、最小配置

1. 配置user信息(必须,不配置的话,最后Git做变更提交时会出现提示信息,提示需要做相关配置)

  • git config [--local | --global | --system] user.name 'your_name'
  • git config [--local | --global | --system] user.email '[email protected]'

作用域区别:

  • local:只对用户当前工作仓库有效(缺省值)
  • global:对当前用户所有仓库有效(常用
  • system:对系统所有登录的用户有效(不常用)

注:优先级为local > global > system

2. 显示config的配置

git config --list [--local | --global | --system]

3. 清除unset

git config --unset [--local | --global | --system] user.name

猜你喜欢

转载自www.cnblogs.com/hg-love-dfc/p/10261058.html