I was trying to install git on ubuntu, but there is an error when I try to install or fix broken git installation. This is the error:
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)
I tried other possibles solutions, I will list here:
apt --fix-broken install
. Error: The same problem as above.apt purge git
. Show me to make anapt fix broken install
sudo dpkg -i --force-overwrite /var/cache/apt/archives/git_1%3a2.17.1-1ubuntu0.8_amd64.deb
. Error:dpkg-query: warning: files list file for package 'git' missing; assuming package has no files currently installed
- I tried to remove all files inside
dpkg/updates
,apt/lists
,apt/*.bin
, and clen apt-get, to try to force the installation, but again the same error above.
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
- I tryed to remove the git
.deb
file from/var/cache/apt/archives
and install git again, but doesn’t work.
Advertisement
Answer
I resolved the problem with the commands below:
sudo apt-mark hold git sudo dpkg -r --force-depends git
And then install git-core
sudo apt install git-core