Git配置

2019-02-27  本文已影响0人  水边的阿狄丽娜_ac41

安装下载好Git之后,需要进行的操作就是git配置。

一、创建本地库

在项目目录里 git init 创建本地仓库,会生成.git目录。里面有本地仓库的信息

在项目目录里创建git仓库

二、git的配置目录:

1)etc/gitconfig      system

2)~/.gitconfig      global

3).git/config            local

三、配置用户信息

为什么要进行user.name和user.email配置呢?每次git提交时都会引用这两条信息,说明是谁提交了更新。将这些信息和更新内容一起纳入历史记录

配置信息:

git config --global user.name 'your_name'

git config --global user.email 'your_eamil'

以上两条命令是配置global作用域的用户信息  即在当前用户下的所有git仓库都使用此用户信息

git config --system user.name 'your_name'

git config --system user.email 'your_email'

配置system作用域的用户信息,即计算机系统里所有用户的git仓库都使用

git config --local user.name 'your_name'

git config --local user.email 'your_email'

配置local作用用户信息,global,system类似 不加单引号也是可以的

配置local作用域的用户信息,即在当前的本地库中的用户信息

三、查看用户信息

git config --global --list

git config --system --list

git config --local --list

system global类似 local作用域的用户信息

注:在实际开发过程中我们一般配置global作用域的用户信息

上一篇 下一篇

猜你喜欢

热点阅读