配置
2026年8月9日 2026年8月10日
分两种:
- 全局配置
- 项目内配置
查看全部信息
BASH
1git config --list
配置代理
全局
BASH
1git config --global http.proxy http://127.0.0.1:<端口号>
2git config --global https.proxy http://127.0.0.1:<端口号>
取消
BASH
1git config --global --unset http.proxy
2git config --global --unset https.proxy
配置用户信息
全局
-
查看全局
BASH1git config --global user.name 2git config --global user.email -
配置全局
BASH1git config --global user.name "<用户名>" 2git config --global user.email "<用户邮箱>" -
取消全局配置
BASH1git config --global --unset user.name 2git config --global --unset user.email
项目内配置
BASH
1git config user.name "<用户名>"
2git config user.email "<用户邮箱>"
配置换行转换
warning: in the working copy of '<路径/文件>', LF will be replaced by CRLF the next time Git touches it
文件编码为utf-8或者utf-8-unix时,使用LF(Linux/macOS换行符)。
在Windows上提交,Git会将其转换为CRLF(Windows换行符)并给出提醒。
全局关闭转换
BASH
1git config --global core.autocrlf false