查看git所有配置项

  1. $ git config -l
  2. or
  3. $ git config --list

全局配置用户名邮箱

  1. $ git config --global user.name "young"
  2. $ git config --global user.email "young@163.com"

根据项目配置:

  • 切换到项目目录下,配置用户名和密码:
  1. $ git config user.name "young"
  2. $ git config user.email "young@163.com"
  • 配置信息的存储位置
  1. 对应的本地仓库的.git文件中的config文件
  2. 在当前项目目录下使用 cat .git/config,就可以看到配置文件内容
  3. $ cat .git/config
  4. [core]
  5. repositoryformatversion = 0
  6. filemode = false
  7. bare = false
  8. logallrefupdates = true
  9. symlinks = false
  10. ignorecase = true
  11. [remote "origin"]
  12. url = https://github.com/***/***.git
  13. fetch = +refs/heads/*:refs/remotes/origin/*
  14. [branch "master"]
  15. remote = origin
  16. merge = refs/heads/master

git config解析

  1. user.email=leo@xxx.com
  2. user.name=leo
  3. core.ignorecase=false # 不许忽略文件名大小写
  4. core.autocrlf=input # 换行模式为 input,即提交时转换为LF,检出时不转换
  5. core.filemode=false # 不检查文件权限
  6. core.safecrlf=true # 拒绝提交包含混合换行符的文件
  7. core.editor=vim
  8. core.repositoryformatversion=0 # Internal variable identifying the repository format and layout version
  9. core.bare=false # 默认不创建裸仓库
  10. core.logallrefupdates=true # log 所有 ref 的更新
  11. core.precomposeunicode=true # Mac专用选项,开启以便文件名兼容其他系统
  12. push.default=simple # 只推送本地当前分支,且与上游分支名字一致
  13. alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
  14. pull.rebase=true # 强制开启 rebase 模式
  15. credential.helper store // 记住密码
  16. // 推荐配置
  17. git config --global user.email mtide@xxx.com"
  18. git config --global user.name=mtide
  19. sudo git config --system core.ignorecase false
  20. sudo git config --system core.autocrlf input
  21. sudo git config --system core.filemode false
  22. sudo git config --system core.safecrlf true
  23. sudo git config --system core.editor vim
  24. sudo git config --system core.repositoryformatversion 0
  25. sudo git config --system core.bare false
  26. sudo git config --system core.logallrefupdates true
  27. sudo git config --system core.precomposeunicode true
  28. sudo git config --system push.default simple
  29. 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"
  30. sudo git config --system pull.rebase true
  31. sudo git config credential.helper store // 记住密码

配置记住密码

  1. [core]
  2. autocrlf = true
  3. excludesfile = C:\\Users\\lixinglong\\Documents\\gitignore_global.txt
  4. [user]
  5. name = leo
  6. email = leo@***.cn
  7. [credential]
  8. helper = store // 这样配置就会记住密码了

git全局配置修改

  1. $ git config -e --global

进入全局配置文件,击字母i,进入编辑状态,修改里面的内容。

连接远程仓库相关命令

  1. // 查看git远程库信息
  2. $ git remote -v
  3. // 查看remote地址,远程分支,还有本地分支与之相对应关系等一系列信息
  4. $ git remote show origin

远程仓库的移除与重命名

如果想要重命名引用的名字可以运行 git remote rename 去修改一个远程仓库的简写名。 例如,想要将 pb 重命名为 paul,可以用 git remote rename 这样做:

  1. $ git remote rename pb paul
  2. $ git remote
  3. origin
  4. paul

值得注意的是这同样也会修改你的远程分支名字。 那些过去引用 pb/master 的现在会引用 paul/master

如果因为一些原因想要移除一个远程仓库 - 你已经从服务器上搬走了或不再想使用某一个特定的镜像了,又或者某一个贡献者不再贡献了 - 可以使用 git remote rm

  1. $ git remote rm paul
  2. $ git remote
  3. origin

参考文章:
https://blog.csdn.net/weixin_33768153/article/details/81026687
Git官方文档-2.5 Git 基础 - 远程仓库的使用

Git配置信息相关命令的更多相关文章

  1. Linux网络配置及相关命令

    Linux的网络配置是曾一直是我学习Linux的埋骨之地,投入了大量的精力和心神让自己的虚拟机联网.后来发现,仅仅是一个大意,我在这个坑上一躺就是一年半.现在总结一下这个伤心地.希望对有帮助. VMw ...

  2. Git配置和常用命令

    Git配置 git config --global user.name "hunng" git config --global user.email "huangthin ...

  3. Git学习笔记-相关命令记录

    内容来自:https://www.liaoxuefeng.com/wiki/896043488029600/896067074338496 1.Linux安装Git 首先,你可以试着输入git,看看系 ...

  4. git远程操作相关命令(remote 、push、fetch 、pull)

    git remote 为了便于管理,Git要求每个远程主机都必须指定一个主机名.为了便于管理,Git要求每个远程主机都必须指定一个主机名. git remote[查看创库名] git remote 在 ...

  5. 『学了就忘』Linux基础命令 — 34、配置网络相关命令

    目录 1.配置网络常用命令 2.ifconfig命令 3.ping命令 4.netstat 命令 使用1:查看本机开启的端口 使用2:查看本机有哪些程序开启的端口 使用3:查看所有连接 使用4:查看网 ...

  6. git 配置别名简化命令行和删除别名

    废话不多说直接上添加别名语法 加上--global是针对当前用户起作用的,如果不加,那只针对当前的仓库起作用. git config --global alias.<自己想要的命令行> & ...

  7. linux下查看硬件配置的相关命令

    from:http://www.jakee.cn/index.php/archives/501.html 常用命令整理如下:查看主板的序列号: dmidecode | grep -i ’serial ...

  8. [git]撤销的相关命令:reset、revert、checkout

    基本概念 工作区 暂存区 本地版本仓库 远程版本仓库 如果不清晰上面的四个概念,请查看廖老师的git教程 这里我多说几句:最开始我使用git的时候,我并不明白我为什么写完代码要用git的一些列指令把我 ...

  9. Git 配置环境及常用命令整理

    一.Git教程网站 廖雪峰网站 易百GitHub命令:https://www.yiibai.com/git/git_clone.html 完成Windows环境命令下Git config配置 设置好之 ...

随机推荐

  1. java 数组转字符串 字符串转数组

    字符串转数组 使用Java split() 方法 split() 方法根据匹配给定的正则表达式来拆分字符串. 注意: . . | 和 * 等转义字符,必须得加 \\.多个分隔符,可以用 | 作为连字符 ...

  2. Windows下VMware14黑屏

    解决方法 以管理员身份运行命令提示符,执行netsh winsock reset

  3. P1886 P2216 单调队列模板

    何为单调队列? 单调队列是一个队列(废话) 而且必须同时满足下标单调和值单调两个单调特性. 跟优先队列不同,优先队列直接使用堆(heap)来实现,如何删去特定下标元素?不明. 本人喜欢用单调队列存下标 ...

  4. JavaScript原型详解

    1,前言 下面是2008年Github创建以来,各种编程语言的排名情况 排名其中JavaScript自2015年之后就盘踞第一名,成为github上被使用最多的语言,早期,JS的使用还主要集中于浏览器 ...

  5. bzoj2007 NOI2010 海拔(对偶图)

    80分(最小割)思路 先考虑如果没有题目中东南角为\(1\)那个限制的话会怎样. 那么只要让每个点的海拔都是\(0\)就行了.这样不论怎样走,最后的答案都是0. 然后再考虑那个东南角为\(1\)的限制 ...

  6. Django 异步化库celery和定时任务

    首先要了解Django其实是个同步框架,那么多个用户发送请求时就会发生排队的情况上一个用户的请求完成后在进行下一个,这样会对影响用户体验,所有就要用到异步方法来解决. 首先我们要安装celery库 p ...

  7. Python之常用模块--collections模块

    认识模块 什么是模块? 常见的场景:一个模块就是一个包含了python定义和声明的文件,文件名就是模块名字加上.py的后缀. 但其实import加载的模块分为四个通用类别: 1 使用python编写的 ...

  8. ElasticSearch6.5.0 【Rejecting mapping update to [posts] as the final mapping would have more than 1 type】

    今天想在一个Index上增加一个type,结果报错 java.lang.IllegalArgumentException: Rejecting mapping update to [posts] as ...

  9. vertical-align垂直对齐用法

    一.垂直对齐方式{vertical-align:middle/top/bottom:} <img>垂直对齐方式:1)给自身加vertical-align:再设置line-height即可: ...

  10. 如何修改const常量值

    总结:这个跟计算机语言类别和编译器有关,本文是在linux环境下说明的. 分两种情况: 1. C语言: 2. C++语言: /*! * \Description: * \author scictor ...