查看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 基础 - 远程仓库的使用

最新文章

  1. sitemesh2在tomcat和weblogic中同时使用的配置问题
  2. Math对象常用方法汇总
  3. C语言+SDL2 图形化编程
  4. Gym 100851G Generators (vector+鸽笼原理)
  5. NSDate使用
  6. 定时导出Oracle数据表到文本文件的方法
  7. xamarin.ios 豆瓣电台视频教程
  8. [OJ] Find Minimum in Rotated Sorted Array
  9. MVC自学系列之四(MVC模型-Models)
  10. win7 vs2010 安装cocos2d-x
  11. VR全景加盟-全景智慧城市携万千创业者决战BAT
  12. Asp.NETCore轻松学系列阅读指引目录
  13. BUAAOO第二单元多线程电梯作业总结
  14. springboot 使用mysql(mybatis)
  15. MVC四大筛选器—ExceptionFilter
  16. VSCode里面HTML添加CSS时没有提示
  17. 基于.NET Standard的分布式自增ID算法--Snowflake
  18. PCL滤波介绍(1)
  19. Linux下Tomcat端口、进程以及防火墙设置
  20. SQL Server中如何实现遍历表的记录

热门文章

  1. 代码合并工具Beyond Compare的使用技巧
  2. 关于react-native在MacBookPro环境下的安装
  3. sqlserver2008查看表记录或者修改存储过程出现目录名无效错误解决方法
  4. php递归函数中使用return的注意事项
  5. 点赞功能与redis
  6. 以太网 ------ Auto-Negotiation(自动协商)
  7. POJ3417 LCA+树dp
  8. maven-compiler-plugin报错
  9. Redis分布式锁----乐观锁的实现,以秒杀系统为例
  10. django中文学习资料