查看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配置信息相关命令的更多相关文章

  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. 时间复杂度和大O表示法

    大O表示法:称一个函数g(n)是O(f(n)),当且仅当存在常数c>0和n0>=1,对一切n>n0均有|g(n)|<=c|f(n)|成立,也称函数g(n)以f(n)为界或者称g ...

  2. A1072. Gas Station

    A gas station has to be built at such a location that the minimum distance between the station and a ...

  3. Django(四)框架之第三篇模板语法

    https://www.cnblogs.com/yuanchenqi/articles/6083427.htm https://www.cnblogs.com/haiyan123/p/7725568. ...

  4. PHP选择排序算法

    说明: 通过假设一个最小数的key,来逐个比较后面的值,如果假设的值大于后面的值,则互换位置. 示例: <?php $a = array(2,13,42,34,56,23,67,365,8766 ...

  5. django基于restframework的CBV封装

    一.models数据库映射 from django.db import models # Create your models here. class Book(models.Model): titl ...

  6. haploview出现“results file must contain a snp column”的解决方法

    将plink文件用“--recode HV ”的参数生成即可 /software/plink --file yourfile --recode HV --snps-only just-acgt --o ...

  7. php中加密和解密

    项目要和第三方进行接口对接,所以数据的安全很重要.第一次自己设计并实现,学习记录下 网上查了很多资料,真的很深奥 对称加密: 双方共用一个约定好的密钥进行数据的加密和解密,但是当密匙丢失,数据将有泄露 ...

  8. google chrome 浏览器书签丢失问题

    在一次新打开标签页时,电脑卡死,强制重启后打开google chrome 浏览器,发现历史什么的都在,但书签栏全部丢失了 找到 系统盘:\Users\用户名\AppData\Local\Google\ ...

  9. M1-SaltStack&Flask-Day4

    1.virtualenv 虚拟环境 2.virtualenv env1 -p= 解释器路径 3. 进入Scripts 执行activate 激活配置 4.执行deactivate 取消激活配置 2.1 ...

  10. mysql常用快速查询修改操作

    mysql常用快速查询修改操作 一.查找并修改非innodb引擎为innodb引擎 # 通用操作 mysql> select concat('alter table ',table_schema ...