繁体   English   中英

无法修复损坏的 Git 安装在 Ubuntu 上

[英]Can't Fix Broken Git installation on Ubuntu

我试图在 ubuntu 上安装 git,但是当我尝试安装或修复损坏的 git 安装时出现错误。 这是错误

cp: cannot stat '/usr/lib/git-core/git': No such file or directory
dpkg: error processing archive /var/cache/apt/archives/git_1%3a2.17.1-1ubuntu0.8_amd64.deb (--unpack):
 new git package pre-installation script subprocess returned error exit status 1
dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed
dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed
Errors were encountered while processing:
 /var/cache/apt/archives/git_1%3a2.17.1-1ubuntu0.8_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试了其他可能的解决方案,我将在这里列出:

  • apt --fix-broken install 错误:与上述相同的问题。
  • apt purge git 让我做一个apt fix broken install
  • sudo dpkg -i --force-overwrite /var/cache/apt/archives/git_1%3a2.17.1-1ubuntu0.8_amd64.deb 错误: dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed
  • 我试图删除dpkg/updatesapt/listsapt/*.bin和 clen apt-get 中的所有文件,以尝试强制安装,但同样出现上述错误。
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists/*
sudo rm /var/cache/apt/*.bin
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo dpkg --configure -a
sudo apt-get install -f
  • 我尝试从/var/cache/apt/archives中删除 git .deb文件并再次安装 git,但不起作用。

我用以下命令解决了这个问题:

sudo apt-mark hold git
sudo dpkg -r --force-depends git

然后安装git-core

sudo apt install git-core

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM