Windows上的Git BASH提供了大部分常用的Linux命令行工具,比如grep、sed等,但是并没有提供tmux。 实际上Git for Windows提供了包管理(package management)功能,
Git for Windows is based on MSYS2 which bundles Arch Linux’ Pacman tool for dependency management.
借助pacman,Git for Windows可以安装额外的命令行工具,比如tmux。 但是,在Git BASH里,pacman并没有默认开启,
This is intended. We do not ship pacman with Git for Windows. If you are interested in a fully fledged package manager maintained environment you have to give the Git for Windows SDK a try.
需要安装Git for Windows SDK来开启pacman。 安装好之后,打开Git SDK(和Git Bash一样,是一个终端模拟器),
$ pacman -Ss tmux
会找到两个包,
msys/tmux 2.6-1
A terminal multiplexer
msys/tmux-git 2.5.94.g73b9328c-1
A terminal multiplexer
$ pacman -S msys/tmux-git
安装的时候可能会报下面的错误,
$ pacman -S msys/tmux
warning: database file for 'git-for-windows-mingw32' does not exist
error: failed to prepare transaction (could not find database)
打开/etc/pacman.conf
文件,注释掉下面的行即可,
#[git-for-windows]
#Server = https://wingit.blob.core.windows.net/x86-64
#[git-for-windows-mingw32]
#Server = https://wingit.blob.core.windows.net/i686
安装好之后,就可以在Windows上(Git SDK)使用tmux了。
pacman的用法可参见Git for Windows的Wiki。
环境:Windows 10
(如果发现某些程序,比如ssh,报错,可以尝试用pacman -Syu
升级所有package。)