Git配置信息相关命令
查看git所有配置项
$ git config -l
or
$ git config --list
全局配置用户名邮箱
$ git config --global user.name "young"
$ git config --global user.email "young@163.com"
根据项目配置:
- 切换到项目目录下,配置用户名和密码:
$ git config user.name "young"
$ git config user.email "young@163.com"
- 配置信息的存储位置
对应的本地仓库的.git文件中的config文件
在当前项目目录下使用 cat .git/config,就可以看到配置文件内容
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://github.com/***/***.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
git config解析
user.email=leo@xxx.com
user.name=leo
core.ignorecase=false # 不许忽略文件名大小写
core.autocrlf=input # 换行模式为 input,即提交时转换为LF,检出时不转换
core.filemode=false # 不检查文件权限
core.safecrlf=true # 拒绝提交包含混合换行符的文件
core.editor=vim
core.repositoryformatversion=0 # Internal variable identifying the repository format and layout version
core.bare=false # 默认不创建裸仓库
core.logallrefupdates=true # log 所有 ref 的更新
core.precomposeunicode=true # Mac专用选项,开启以便文件名兼容其他系统
push.default=simple # 只推送本地当前分支,且与上游分支名字一致
alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
pull.rebase=true # 强制开启 rebase 模式
credential.helper store // 记住密码
// 推荐配置
git config --global user.email “mtide@xxx.com"
git config --global user.name=mtide
sudo git config --system core.ignorecase false
sudo git config --system core.autocrlf input
sudo git config --system core.filemode false
sudo git config --system core.safecrlf true
sudo git config --system core.editor vim
sudo git config --system core.repositoryformatversion 0
sudo git config --system core.bare false
sudo git config --system core.logallrefupdates true
sudo git config --system core.precomposeunicode true
sudo git config --system push.default simple
sudo git config --system alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
sudo git config --system pull.rebase true
sudo git config credential.helper store // 记住密码
配置记住密码
[core]
autocrlf = true
excludesfile = C:\\Users\\lixinglong\\Documents\\gitignore_global.txt
[user]
name = leo
email = leo@***.cn
[credential]
helper = store // 这样配置就会记住密码了
git全局配置修改
$ git config -e --global
进入全局配置文件,击字母i,进入编辑状态,修改里面的内容。
连接远程仓库相关命令
// 查看git远程库信息
$ git remote -v
// 查看remote地址,远程分支,还有本地分支与之相对应关系等一系列信息
$ git remote show origin
远程仓库的移除与重命名
如果想要重命名引用的名字可以运行 git remote rename 去修改一个远程仓库的简写名。 例如,想要将 pb 重命名为 paul,可以用 git remote rename 这样做:
$ git remote rename pb paul
$ git remote
origin
paul
值得注意的是这同样也会修改你的远程分支名字。 那些过去引用 pb/master 的现在会引用 paul/master。
如果因为一些原因想要移除一个远程仓库 - 你已经从服务器上搬走了或不再想使用某一个特定的镜像了,又或者某一个贡献者不再贡献了 - 可以使用 git remote rm :
$ git remote rm paul
$ git remote
origin
参考文章:
https://blog.csdn.net/weixin_33768153/article/details/81026687
Git官方文档-2.5 Git 基础 - 远程仓库的使用
Git配置信息相关命令的更多相关文章
- Linux网络配置及相关命令
Linux的网络配置是曾一直是我学习Linux的埋骨之地,投入了大量的精力和心神让自己的虚拟机联网.后来发现,仅仅是一个大意,我在这个坑上一躺就是一年半.现在总结一下这个伤心地.希望对有帮助. VMw ...
- Git配置和常用命令
Git配置 git config --global user.name "hunng" git config --global user.email "huangthin ...
- Git学习笔记-相关命令记录
内容来自:https://www.liaoxuefeng.com/wiki/896043488029600/896067074338496 1.Linux安装Git 首先,你可以试着输入git,看看系 ...
- git远程操作相关命令(remote 、push、fetch 、pull)
git remote 为了便于管理,Git要求每个远程主机都必须指定一个主机名.为了便于管理,Git要求每个远程主机都必须指定一个主机名. git remote[查看创库名] git remote 在 ...
- 『学了就忘』Linux基础命令 — 34、配置网络相关命令
目录 1.配置网络常用命令 2.ifconfig命令 3.ping命令 4.netstat 命令 使用1:查看本机开启的端口 使用2:查看本机有哪些程序开启的端口 使用3:查看所有连接 使用4:查看网 ...
- git 配置别名简化命令行和删除别名
废话不多说直接上添加别名语法 加上--global是针对当前用户起作用的,如果不加,那只针对当前的仓库起作用. git config --global alias.<自己想要的命令行> & ...
- linux下查看硬件配置的相关命令
from:http://www.jakee.cn/index.php/archives/501.html 常用命令整理如下:查看主板的序列号: dmidecode | grep -i ’serial ...
- [git]撤销的相关命令:reset、revert、checkout
基本概念 工作区 暂存区 本地版本仓库 远程版本仓库 如果不清晰上面的四个概念,请查看廖老师的git教程 这里我多说几句:最开始我使用git的时候,我并不明白我为什么写完代码要用git的一些列指令把我 ...
- Git 配置环境及常用命令整理
一.Git教程网站 廖雪峰网站 易百GitHub命令:https://www.yiibai.com/git/git_clone.html 完成Windows环境命令下Git config配置 设置好之 ...
随机推荐
- HDU/HDOJ 4699 Editor
对顶栈算法. 此题充分说明了cin的不中以及scanf的优越性. 我TM用cin超时了!!!换成scanf就A了!!! #include <cstdio> #include <cst ...
- 【洛谷P1403】约数研究
题目大意:求\[\sum\limits_{i=1}^n\sum\limits_{d|i}1\] 题解:交换求和顺序即可. \[\sum\limits_{i=1}^n\sum\limits_{d|i}1 ...
- sprintf() 处理 float类型的数字,保留小数位等。
关于 sprintf()的百科地址: http://baike.baidu.com/view/1295144.htm sprintf(szText, "%[填空字元][宽度][.精度]f&q ...
- 第五篇:数据备份、pymysql模块
http://www.cnblogs.com/linhaifeng/articles/7525619.html#_label3 一 IDE工具介绍 生产环境还是推荐使用mysql命令行,但为了方便我们 ...
- struts2 contextMap
一.contextMap中的数据操作 root根:List 元素1 元素2 元素3 元素4 元素5 contextMap:Map key value application Map key value ...
- Gym 101911F “Tickets”
传送门 题意: 给你一个由六位数字组成的门票编码x,并定义F(x) = | 前三位加和 - 后三位加和|: 求出给定的门票编码 x 之前并且 F(i) < F(x) 的 i 的总个数. 题解: ...
- Unity 着色器基础知识
一.着色器基础知识 着色器通过代码模拟物体表面发生的事情,其实就是GPU中运行的一段代码. 着色器的类型: 顶点着色器.片元着色器.无光照着色器.表面着色器.图像特效着色器.计算着色器. 坐标空间: ...
- 【清北学堂2018-刷题冲刺】Contest 6
Task 1:子集 [问题描述] 若一个集合S中任意两个元素x和y,都满足x⊕y<min(x, y) ,则称集合S是"好的".其中⊕为按位异或运算符.现在给定一个大小为n ...
- 8 款macOS 分屏应用让你的桌面窗口不再乱糟糟
有时我们想在 Mac 屏幕左边开一个 Word,右侧放一个参考资料:有时我们想把 GTD 应用放在屏幕一角,随时查看.可是,Mac 原生窗口管理不够人性化,总需要用户手动把窗口调整到合适的尺寸与位置. ...
- Redis作为lru缓存作用
当 Redis 作为缓存使用时,当你添加新的数据时,有时候很方便使 Redis 自动回收老的数据.LRU 实际上是被唯一支持的数据移除方法.Redis 的 maxmemory 指令,用于限制内存使用到 ...