🌿需求
安装git后,运行git bash命令行窗口的身份标识属性默认是 user@host
,需要改为user,例:
需要把 GXN@DESKTOP-N35QUA8
改为 GXN
🌸解决
🍋 1. 找到git 的安装目录
where git
🍋 2. 找到etc\profile.d\git-prompt.sh
文件
如下,找到git-prompt.sh
🍋 3.修改或替换 PS1="$PS1"'\u@\h '
为 PS1="$PS1"'\u '
修改etc\profile.d\git-prompt.sh
文件里的user@host属性,一般是在第15行。
- 修改前
PS1="$PS1"'\u@\h ' # user@host<space>
- 修改后
PS1="$PS1"'\u ' # user
记得保存