How To Install Git on Ubuntu 20.04 LTS Focal Fossa Linux -

The objective is to install and perform basic setup of Git on Ubuntu 20.04 LTS Focal Fossa Linux
This is a companion discussion topic for the original entry at

Things are not looking good on my end. Before I state my problem, I want to point out that I am running a dual operating system. I choose which system I would like to run on the start up screen.

Using Ubuntu, I am simply trying to install git. This is the error that keeps popping up
E: The package code needs to be reinstalled, but I can’t find an archive for it.

sudo apt install git bears the error
sudo apt install git-all bears the error

sudo dpkg --remove --force-all git followed by sudo apt-get update + a restart does nothing

So then I thought, “Well, let’s just make a backup of the dpkg status file”
sudo cp /var/lib/dpkg/status status.bkp followed by sudo gedit /var/lib/dpkg/status (to open the dpkg status file for editing)
BUT BEHOLD, THERE APPEARS TO BE NO Package: git in the 50,000 lines of code :smiley:

Weird right? Well remember how I have 2 operating systems?

“When you install Ubuntu package off-line usually in first of installation its cache doesn’t get updated so this error will occur and you have in your Ubuntu broken packages.”

So I pop open the terminal, and type sudo apt-get install -f BUT IT BEARS THE SAME ERROR! Does this mean I should just absolutely destroy this laptop, or?

Hi Pgkb78,

Welcome to our forums.

If by saying you have a dual operating system you mean you have to systems that use the same package database, it isn’t really surprising they mess it up.

If this is so, then yes, my advice would be: printcreen it, backup data, then purge it. Clean install afterwards.

I do not have two systems that use the same package database. Only linux is using the PD. And I do apologize I should have specified that I am dual booting…linux and windows are in two separate memory partitions…

Hi Pgkb78,

Well that’s much more viable setup, I imagined some sort of parallel boot image trickery which reside on and use the same filesystem. You completely got me there :smiley:

In this case there should be some sort of inconsistency with your packages and/or repositories. Is your Ubuntu a fresh 20.04? If so, did you install it so or upgraded from a previous version (or updated from beta)?

Yes it is the 20.04 version

And if you query dkpg it shows no git package installed? I do have git, and it shows up like this:

$ dpkg -l | grep "distributed revision control"
ii  git                                           1:2.17.1-1ubuntu0.7                                 amd64        fast, scalable, distributed revision control system
ii  git-man                                       1:2.17.1-1ubuntu0.7                                 all          fast, scalable, distributed revision control system (manual pages)

This is a 18.04 output, so your version may differ. Please post what you find with dpkg. You should get an empty output if no match.