目录
- 安装linux子系统
- 安装zsh、oh-my-zsh
- 设置Idea的默认Terminal
- 解决git status 所有文件被修改问题
安装unbantu 子系统
- 在window控制面板–>程序功能—>启用或关闭Windows 功能;
- 在里面找到 适用于Linux的Windows 子系统,并勾选;确认
在管理员权限下的powershell里面执行(可能会很慢)
安装 zsh
1
| sudo apt-get install -y zsh
|
安装 oh-my-zsh
1 2
| # https://ohmyz.sh/#install 地址随时会变以官网为准 sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
问题1
提示 curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL ...
在浏览器 下载install.sh文件
1 2 3 4 5 6
| # 移动到 wsl账号目录下面 mv install.sh ~/ # 赋予最高权限 chmod 777 install.sh # 手动执行安装 sh -c ./install.sh
|
设置Idea默认terminal
在设置中、找到 terminal,将路径设置为C:\Windows\System32\wsl.exe -d Ubuntu
解决 shell 乱码问题
- 打开终端属性
- 修改字体 为 MS Gothic
解决 git 文件夹命令卡顿
1 2 3 4
| #设置 oh-my-zsh 不读取文件变化信息(在 git 项目目录执行下列命令) git config --add oh-my-zsh.hide-dirty 1 #如果你还觉得慢,可以再设置 oh-my-zsh 不读取任何 git 信息 git config --add oh-my-zsh.hide-status 1
|
解决 每次需要输入账号密码问题
1
| git config --global credential.helper store
|
解决 git status 与win 状态不一致问题
- 由于windows下的权限和Linux的权限不一致,导致的git检测文件状态变更,需要我们关闭WSL中git的文件权限检测:
1 2
| # 全局设置 git config --global core.filemode false
|
- Windows中使用的文本换行方式是CRLF,Linux中使用的文本换行方式是LF,然后WSL是Linux环境,默认使用LF换行方式,所以git会自动将代码当中与WSL系统不同的换行方式转化成WSL换行方式,从而状态发生变动。需要我们禁止WSL自动转换文本换行模式:
1 2
| # 全局设置 git config --global core.autocrlf true
|
解决tail -f 不生效问题
1 2 3 4 5 6 7
| tail ---disable-inotify -f log/catalina.out # vi ~/.profile alias tail='tail ---disable-inotify ' source ~/.profile # try again tail -f log/catalina.out
|