您现在的位置是:首页 >技术交流 >如何快速查询Git的config配置文件的本地路径网站首页技术交流
如何快速查询Git的config配置文件的本地路径
简介如何快速查询Git的config配置文件的本地路径
如何快速查询Git的config配置文件的本地路径
| 命令 | 作用 |
|---|---|
git config --local --list --show-origin | 查看仓库级别 git 配置信息,并打印配置文件本地路径最高优先级(仓库下) |
git config --global --list --show-origin | 查看全局级别 git 配置信息,并打印配置文件本地路径中间优先级 |
git config --system --list --show-origin | 查看系统级别 git 配置信息,并打印配置文件本地路径最低优先级 |
git config --local --list --show-origin ☞ 最高优先级(仓库级别)

git config --global --list --show-origin ☞ 中间优先级(全局级别)

git config --system --list --show-origin ☞ 最低优先级(系统级别)

如何快速修改配置文件
| 命令 | 作用 |
|---|---|
git config --local -e | 编辑.git/config文件,会自动调notepad++ |
git config --global -e | |
git config --system -e |
弹出编辑器快速修改

其他关于config的操作
查看 config
| 命令 | 作用 |
|---|---|
git config --local -l | 查看仓库级别 git 配置信息 |
git config --global -l | 查看全局级别git 配置信息 |
git config --system -l | 查看系统级别 git 配置信息 |
git config -l | 查看当前所有级别全部配置信息 |
git config --local --list --show-origin | 查看仓库级别 git 配置信息,并打印配置文件本地路径最高优先级(仓库下) |
git config --global --list --show-origin | 查看全局级别 git 配置信息,并打印配置文件本地路径中间优先级 |
git config --system --list --show-origin | 查看系统级别 git 配置信息,并打印配置文件本地路径最低优先级 |
| `git config -l | grep core` |
编辑 config
| 命令 | 作用 |
|---|---|
git config --local -e | 编辑.git/config文件,会自动调notepad++ |
git config --global -e | |
git config --system -e | |
git config --global user.email “xxxxx@qq.com” | |
git config --global user.name “xxxxx” | |
git config --global --add user.age 10 | 增加 |
git config --global --unset user.age | 删除 |
git config --global alia.st status | 给命令配置别名,比如用st代替status |
git config –global core.autocrlf true | git在push时 crlf → lf,pull时 lf → crlf ;(默认值);本地crlf,仓库lf |
git config –global core.autocrlf false | git在 push 和 pull 的时候不转换; |
git config –global core.autocrlf input | git在push时crlf → lf,pull时不转换;本地lf,仓库lf;(为了消除失误引入的CRLF) |
git config --global push.default simple | 不带任何参数的git push, 默认只推送当前分支,这叫做simple方式 |
git config --global push.default matching | 还有一种叫做matching方式,会推送所有有对应的远程分支的本地分支 |
参考
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。





U8W/U8W-Mini使用与常见问题解决
QT多线程的5种用法,通过使用线程解决UI主界面的耗时操作代码,防止界面卡死。...
stm32使用HAL库配置串口中断收发数据(保姆级教程)
分享几个国内免费的ChatGPT镜像网址(亲测有效)
Allegro16.6差分等长设置及走线总结