在windows 10中的bash执行gradle时,老是报:git
Could not determine a usable local IP for this machine.
github
出现这个问题的缘由是windows 10旧版的bash对IPv6的支持很差,参见bashOnwindows的issue。官方说在新版bashOnWindows中已经解决了这个问题。我是最新版的windows 10,在控制面板启用的bash,也是最新版的,但依然存在这个问题,重装bash后才得以解决。ubuntu
解决方法:windows
查看你的Ubuntu版本bash
执行命令:ide
$ lsb_release -a
最新版为:gradle
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial
更新ubuntuthis
注意: 旧版的ubuntu 14.04不能直接升为16.04,只能卸载bash后重装。插件
$ sudo do-release-upgrade
我在16.04更新后依然存在这个问题,因此就卸载了从新安装bash。code
从新安装bash
以管理员身份打开cmd,执行命令卸载bash:
C:\> lxrun /uninstall /full /y
从新安装bash:
C:\> lxrun /install
等待安装结束后从新安装gradle,发现问题已解决。
oh-my-zsh算是在bash环境中必装的了,但安装以后发现进入git类型目录后很是慢,每次cd、ll都须要等很长时间,后来发现缘由是在进入git目录后读取git配置而且刷新目录形成的。oh-my-zsh的主题会根据git本地信息生成好看的目录,但在windows下,卡顿的难以忍受。使用如下命令禁用oh-my-zsh目录刷新便可。
解决方法:
$ git config --global oh-my-zsh.hide-status 1
autojump是在zsh下很好用的插件,能够方便找到你以前进入过的目录,但在bashOnWindows中每次cd时,报错:
autojump_chpwd:4: nice(5) failed: operation not permitted
这是工做区进程优先级致使的问题,设置zsh不要调整你后台进程优先级。
解决方法:
在~/.zshrc
末尾添加行:
unsetopt BG_NICE
Error message with ZSH and use of "&" in Creators Update
windows-10-creators-update-whats-new-in-bashwsl-windows-console/
Zsh ignoring oh-my-zsh.hide-status git config