Git 学习笔记2 - 配置

环境

  • 系统:window 10 x64
  • git版本:Git for windows 2.8.1

配置文件优先级

  • 仓库(.git/config) > 用户(-global) > 系统(-system)

配置的方式

直接修改文件

  • 不同的级别不同位置
    • 仓库级:仓库下的config .git/config
    • 用户级:
    • 系统级:

使用命令行

  • windows:
    • cmd
    • Git Bash :鼠标右键 git bash here 或应用中

配置命令格式

配置的方式

  • git配置的命令为 git config;
  • 查看config文档: git config –help

查看已配置内容:

* 单项:git config 属性
    * 如查看已配置的用户名:git config user.name 
* 查看所有已配置属性:
    * git config --list

配置

  • 配置基本格式
    • git config 位置 属性 属性内容
      • 如配置用户级的git用户名:
        git config –global user.name “John Doe”
      • 位置:
        • 仓库级:在仓库目录下使用不带位置的config
        • 用户级: 位置中使用 –global
        • 系统级: –system
  • 基本配置:用户名和邮箱,在每次提交时都要用到。
    • git config –global user.name “你的用户名”
    • git config –global user.email 你的邮箱地址

常用配置

  • 用户名:
    git config –global user.name “”
  • 邮箱:
    git config –global user.email your
  • 默认编辑器:
    git config –global core.editor

参考链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值