安装 Windows 版本后,WSL 无法看到 Git。使用apt-get install git
会出现以下错误:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
git : Depends: libc6 (>= 2.38) but 2.31-13+deb11u9 is to be installed
Recommends: ssh-client
E: Unable to correct problems, you have held broken packages.
当我尝试时apt-get install libc6=2.38
我得到
Version '2.38' for 'libc6' was not found
这是之后
apt-get update
apt-get upgrade
apt-get clean
apt-get autoclean
dpkg --configure -a
apt-get -f install
这是在 Windows 10 上使用 Debian 全新安装 WSL。
我在网上找到的唯一解决方案是针对 Ubuntu linux 盒子的,并且是关于升级 libc6 或类似的,与安装 git 和未满足的依赖关系问题无关。
解决了我能够通过这个答案找到解决方案:https://askubuntu.com/a/223267/334075
我安装了 aptitude,然后用它来安装 git。
Aptitude 做了更多工作来寻找未满足的依赖项的解决方案,它提出的第二个解决方案只是安装不依赖于更高版本的 libc6 的旧版本 git。