作用:只区分不同开发人员的身份

一、项目级别/仓库级别:仅在当前本地库范围内有效

签名设置用户名(UserName)和邮箱(User@email),邮箱可以是任意邮箱(无效邮箱也可以)

 git config user.name  UserName
git config user.email User@email

例:用户名xingruyu,邮箱xingruyu@qq.com

zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git config user.name xingruyu zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git config user.email xingruyu@qq.com

信息保存位置:./.git/config 文件
zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ ls -al
total
drwxr-xr-x zhang 2月 : ./
drwxr-xr-x zhang 1月 : ../
drwxr-xr-x zhang 2月 : .git/ zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ cat ./.git/config
[core]
repositoryformatversion =
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[user]
name = xingruyu
email = xingruyu@qq.com zhang@SH-B MINGW64 /c/vm/mygithub (master)

用命令查看用户名和邮箱

zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git config user.name
xingruyu

zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git config user.email
xingruyu@qq.com

zhang@SH-B MINGW64 /c/vm/mygithub (master)

二、系统级别:登录当前操作系统的用户范围

 git config --global user.name  UserName
git config --global user.email User@email

信息保存位置:~/.gitconfig 文件

zhang@SH-B MINGW64 ~
$ git config --global user.name zhangfei zhang@SH-B MINGW64 ~
$ git config --global user.email zhangfei@email.com zhang@SH-B MINGW64 ~
$ cat .gitconfig
[user]
name = zhangfei
email = zhangfei@email.com

查看

 git config --global user.name
git config --global user.email

级别优先级,就近原则:项目级别优先于系统用户级别,二者都有时采用项目级别的签名

如果只有系统用户级别的签名,就以系统用户级别的签名为准,二者都没有不允许

三、记录git几个命令

 git rm --cached  文件名  //用于将暂存区的文件恢复到工作区

   zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git add demo
warning: LF will be replaced by CRLF in demo/hello.txt.
The file will have its original line endings in your working directory zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git status
On branch master No commits yet Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: demo/hello.txt zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git rm --cached demo
fatal: not removing 'demo' recursively without -r zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git status
On branch master No commits yet Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: demo/hello.txt zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git rm --cached demo/hello.txt
rm 'demo/hello.txt' zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git status
On branch master No commits yet Untracked files:
(use "git add <file>..." to include in what will be committed)
demo/ nothing added to commit but untracked files present (use "git add" to track) zhang@SH-B MINGW64 /c/vm/mygithub (master) git commit //文件由缓存区提交到本地库 zhang@SH-B MINGW64 /c/vm/mygithub (master) $ git add demo
warning: LF will be replaced by CRLF in demo/hello.txt.
The file will have its original line endings in your working directory zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git status
On branch master No commits yet Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: demo/hello.txt zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git commit demo/hello.txt
warning: LF will be replaced by CRLF in demo/hello.txt.
The file will have its original line endings in your working directory
[master (root-commit) 030671e] first commit
file changed, insertion(+)
create mode demo/hello.txt zhang@SH-B MINGW64 /c/vm/mygithub (master)
$ git status
On branch master
nothing to commit, working tree clean zhang@SH-B MINGW64 /c/vm/mygithub (master) git restore 文件名字 进行清除工作区的改变,与git add 的作用相反 zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ cat hello.txt
hello.test
modify first zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ vi hello.txt zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ cat hello.txt
hello.test
modify first
modify second zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: hello.txt no changes added to commit (use "git add" and/or "git commit -a") zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ git restore hello.txt zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ git status
On branch master
nothing to commit, working tree clean zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ cat hello.txt
hello.test
modify first zhang@SH-B MINGW64 /c/vm/mygithub/demo (master) git restore --staged <file> //撤销git add 的文件 MINGW64 /c/vm/mygithub/demo (master)
$ git add hello.txt zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: hello.txt zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ git restore --staged hello.txt zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: hello.txt no changes added to commit (use "git add" and/or "git commit -a") zhang@SH-B MINGW64 /c/vm/mygithub/demo (master)

git签名设置的更多相关文章

  1. git 代理设置

    git 代理设置: git config --global http.proxy http://proxy.com:8080git config --global https.proxy http:/ ...

  2. git命令设置简写(别名)

    ### git命令设置简写(别名) 前言:有时候在执行git命令比较多的情况下,每次敲git命令比较费时,同时有些命令比如cherry-pick这种比较长时更是费时,所以可以通过设置命令行简写来设置. ...

  3. git Alias 设置

    git Alias 设置 Git 使用比較多的话能够设置一些命令的 Alias ,简单的说就是用简写取代整个完整的命令. 如co 代表 checkout. Mac下,到根文件夹 cd ~ 然后 vi ...

  4. Jenkins Git安装设置

    Jenkins Git安装设置 在此安装中,必须确保Internet连接可连接其安装 Jenkins 机器.在 Jenkins 仪表盘(主屏幕)的左侧单击 Manage Jenkins 选项.打开网址 ...

  5. VS Code 提示‘未找到Git。请安装Git,或在“git.path”设置中配置’

    一.情况说明 1.描述 从Git上克隆出代码,用vscode打开项目提示“未找到Git.请安装Git,或在“git.path”设置中配置” 2.截图 二.报错原因 .没有安装Git .没有设置Git路 ...

  6. go get 无反应方法 Win/Linux 命令行、终端和 Git 代理设置

    go get -u -v 无反应方法 CMD要用管理员权限运行,否则设置无效 netsh winhttp set proxy proxy-server="https=127.0.0.1:10 ...

  7. git中设置代理

    说明:在某种原因下,整个网络都是使用代理的情况下,需要使用git clone,这时就需要设置代理了. 在没有设置代理的时候,直接克隆报错  Failed to connect to gitee.com ...

  8. vscode源代码管理(vscode报错 未找到Git,请安装Git,或在"git.path" 设置中配置)

    vscode源代码管理(vscode报错 未找到Git,请安装Git,或在"git.path" 设置中配置) 直接上图,电脑上已经安装git,由于vscode没有找到git,所以v ...

  9. 取消Git代理设置

    昨天由于在用sourceTree上传下拉代码的时候,速度实在太慢,就照着百度上的方法设置了代理,结果导致sourceTree无法访问服务器,经检查排除发现可能是因为公司网络不能使用代理,被防火墙挡住了 ...

随机推荐

  1. RestTemplate远程调用方法

    概述: spring框架提供的RestTemplate类可用于在应用中调用rest服务,它简化了与http服务的通信方式,统一了RESTful的标准,封装了http链接, 我们只需要传入url及返回值 ...

  2. Netty学习(1):IO模型之BIO

    概述 Netty其实就是一个异步的.基于事件驱动的框架,其作用是用来开发高性能.高可靠的IO程序. 因此下面就让我们从Java的IO模型来逐步深入学习Netty. IO模型 IO模型简单来说,就是采用 ...

  3. leetcode水题题解

    344. Reverse String Write a function that takes a string as input and returns the string reversed. E ...

  4. css:html-font-size

    font-family:"Helvetica Neue",Helvetica,Arial,sans-serif

  5. css-box-shadowing

    box-shadow: h-shadow v-shadow blur spread color inset; 注释:box-shadow 向框添加一个或多个阴影.该属性是由逗号分隔的阴影列表,每个阴影 ...

  6. iomanip、cstring、string、sstream

    #include<iomanip>          控   制   符                             作           用                 ...

  7. [Python源码剖析]字符缓冲池intern机制

    static PyStringObject *characters[UCHAR_MAX + 1]; ... /* This dictionary holds all interned strings. ...

  8. Nginx:Nginx limit_req limit_conn限速

    简介 Nginx是一个异步框架的Web服务器,也可以用作反向代理,负载均衡器和HTTP缓存,最常用的便是Web服务器.nginx对于预防一些攻击也是很有效的,例如CC攻击,爬虫,本文将介绍限制这些攻击 ...

  9. Unity酱~ 卡通渲染技术分析(二)

    前面的话 上一篇Unity酱~ 卡通渲染技术分析(一) 写了CharaMain.cginc,服装的渲染是怎么实现的.这篇来分析一下头发跟皮肤的实现 头发 本来以为unitychan的头发会有各向异性的 ...

  10. Sklearn--(SVR)Regression学习笔记

    今天介绍一个机器学习包,sklearn.其功能模块有regression\classification\clustering\Dimensionality reduction\data preproc ...