为Git仓库设置签名信息

前言

在首次使用git版本库或创建新的仓库时,需要为其仓库设定管理员和管理员邮箱。

在为仓库添加管理员和邮箱地址时,有以下两种情况:

(1)全局模式:首次创建,后面做为默认使用,对当前pc下的所有仓库有效。

(2)局部模式:创建仓库后添加,设定仅对当前仓库有效。

具体如下

一、设定仓库管理员信息

复制代码
# 全局模式(用户级别)(一般在首次指定)
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"

# 局部模式(仓库级别)(初始化仓库后使用)
$ git config user.name "Your Name"
$ git config user.email "email@example.com"

信息保存位置:

  • 全局模式:~/.gitconfig 文件
  • 局部模式:.git/config 文件

二、查看当前仓库管理员信息

复制代码
## 查看仓库当前设定用户信息
$ git config user.name
$ git config user.email

## 查看仓库全局(默认)设定用户信息
$ git config --global user.name
$ git config --global user.email
相关推荐
meowrain11 分钟前
Git HTTPS Token 凭据配置指南
git·网络协议·https
Ws_12 小时前
Git + Gerrit 第二课:diff、暂存区与撤销修改
git
snowjlz13 小时前
鸿蒙版SVN来了!!!
git·svn·版本控制
2401_8769641314 小时前
27考研余炳森概率论|喻老李良2027资料网课
windows·git·考研·svn·eclipse·github·概率论
爱搬砖的狮子15 小时前
【Git】git repo下载使用
git
cheems952718 小时前
Git基本操作
git
Irissgwe19 小时前
三、Git 文件状态管理:add、commit、status 和 diff
git
Ws_1 天前
Git + Gerrit 第三课:分支、切换与合并
git·elasticsearch
xlq223221 天前
6.git
git
Drache_long1 天前
Git命令概述
git