git签名设置
作用:只区分不同开发人员的身份
一、项目级别/仓库级别:仅在当前本地库范围内有效
签名设置用户名(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签名设置的更多相关文章
- git 代理设置
git 代理设置: git config --global http.proxy http://proxy.com:8080git config --global https.proxy http:/ ...
- git命令设置简写(别名)
### git命令设置简写(别名) 前言:有时候在执行git命令比较多的情况下,每次敲git命令比较费时,同时有些命令比如cherry-pick这种比较长时更是费时,所以可以通过设置命令行简写来设置. ...
- git Alias 设置
git Alias 设置 Git 使用比較多的话能够设置一些命令的 Alias ,简单的说就是用简写取代整个完整的命令. 如co 代表 checkout. Mac下,到根文件夹 cd ~ 然后 vi ...
- Jenkins Git安装设置
Jenkins Git安装设置 在此安装中,必须确保Internet连接可连接其安装 Jenkins 机器.在 Jenkins 仪表盘(主屏幕)的左侧单击 Manage Jenkins 选项.打开网址 ...
- VS Code 提示‘未找到Git。请安装Git,或在“git.path”设置中配置’
一.情况说明 1.描述 从Git上克隆出代码,用vscode打开项目提示“未找到Git.请安装Git,或在“git.path”设置中配置” 2.截图 二.报错原因 .没有安装Git .没有设置Git路 ...
- go get 无反应方法 Win/Linux 命令行、终端和 Git 代理设置
go get -u -v 无反应方法 CMD要用管理员权限运行,否则设置无效 netsh winhttp set proxy proxy-server="https=127.0.0.1:10 ...
- git中设置代理
说明:在某种原因下,整个网络都是使用代理的情况下,需要使用git clone,这时就需要设置代理了. 在没有设置代理的时候,直接克隆报错 Failed to connect to gitee.com ...
- vscode源代码管理(vscode报错 未找到Git,请安装Git,或在"git.path" 设置中配置)
vscode源代码管理(vscode报错 未找到Git,请安装Git,或在"git.path" 设置中配置) 直接上图,电脑上已经安装git,由于vscode没有找到git,所以v ...
- 取消Git代理设置
昨天由于在用sourceTree上传下拉代码的时候,速度实在太慢,就照着百度上的方法设置了代理,结果导致sourceTree无法访问服务器,经检查排除发现可能是因为公司网络不能使用代理,被防火墙挡住了 ...
随机推荐
- JAVA中如何获取变量的类型
JAVA中如何获取变量的类型? package xiya; public class Demo { public static void main(String[] args) { String ty ...
- 使用卷影拷贝提取ntds.dit
一.简介 通常情况下,即使拥有管理员权限,也无法读取域控制器中的C:\Windows\NTDS\ntds.dit文件.使用windows本地卷影拷贝服务,就可以获得该文件的副本. 在活动目录中,所有的 ...
- CCF_ 201512-4_送货
一道拖了很久了题,用bool开的vis不会爆内存,dfs回溯的话会超时,于是有了一个很巧妙的dfs. #include<iostream> #include<cstring> ...
- 机器学习(ML)十二之编码解码器、束搜索与注意力机制
编码器—解码器(seq2seq) 在自然语言处理的很多应用中,输入和输出都可以是不定长序列.以机器翻译为例,输入可以是一段不定长的英语文本序列,输出可以是一段不定长的法语文本序列,例如 英语输入:“T ...
- .Net Core中IOC容器的使用
打代码之前先说一下几个概念,那就是什么是IOC.DI.DIP 虽然网上讲这些的已经有很多了,我这里还是要再赘述一下 IOC容器就是一个工厂,负责创建对象的 IOC控制反转:只是把上端对下端的依赖,换成 ...
- SpringCloud五大神兽之Eureka
注册中心概述 什么是注册中心? 相当于服务之间的'通讯录',记录了服务和服务地址之间的映射关系.在分布式架构中服务会注册到这里.当服务需要调用其他服务时,就在注册中心找到其他服务的地址,进行调用 注册 ...
- BeautifulSoup入门
BeautifulSoup库入门 BeautifulSoup库的理解 BeautifulSoup库是解析.遍历.维护”标签树”的功能库 示例代码: from bs4 import BeautifulS ...
- Vim 安装和配置、优化
Vim 介绍 Vim 官网:http://www.vim.org/ Vim 安装 CentOS:sudo yum install -y vim Ubuntu:sudo apt-get install ...
- 怎么用wait、notify巧妙的设计一个Future模式?
我们知道多线程可以实现同时执行多个任务(只是看起来是同时,其实是CPU的时间片切换特别快我们没感觉而已). 现在假设一个做饭的场景,你没有厨具也没有食材.你可以去网上买一个厨具,但是这段时间,你不需要 ...
- Spring——自动装配(@Autowired/@Profile/底层组件)
本文介绍Spring中关于自动装配的方法和规则,以及@Profile动态激活的用法和一个例子. 一.@Autowired自动装配 @Autowired注解可以加在构造器.属性.方法.方法参数上. 自动 ...