Sudo apt upgrade -y is not working in the git labs (and also sudo apt install git-all -y is failing with same issue)

Hi @eduhemanth

Use

sudo apt update

(not upgrade) before running the git install.

TIP:

Although the official git guide says to install git-all, it is sufficient and a lot quicker to just install git

sudo apt install git -y

as described here: How To Install Git on Ubuntu 20.04 | DigitalOcean

Note that -y tells apt to assume yes for any yes.no question.

this issue still persists for the lab, hopwever the same dosent have any issues on Ubuntu 22.04 from playground with gzip 1.10

Hello,
When you open your first lab in “Git for beginners” course there you will encounter this error. This error normally happens when you try to do “sudo apt-get upgrade” because without upgrading you can’t install Git.
I have solved the issue using these steps:
First run the following commands to clear the package cache:

sudo apt clean
sudo apt autoclean

Next we need to purge the problematic package. In your case, it’s gzip, so let’s purge that and then we will do -f install in order to fix any broken dependencies.:

sudo dpkg --purge --force-all gzip
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade

Next we will try to update and upgrade again, if it gives the error of broken dependencies, we can try doing:

sudo apt-get --fix-broken install

If we again gets error with any other package, we need to purge that package again, just like the first step above:

sudo dpkg --purge --force-all problematicPackage

and We will again clean the package cache, fix any broken dependencies using sudo apt-get install -f and sudo apt --fix-broken install
After fixing the dependencies, we can reconfigure the package by following command:

sudo dpkg --configure -a

and then we can try sudo apt-get upgrade again and it will work.

That’s a bit long winded.

All that’s required is

sudo apt update
sudo apt install -y zip git

or all on one like

sudo apt update && sudo apt install -y zip git