E: Could not find git package - Ubuntu on EC2

It seems to me that there may be problems with Ubuntu EC2 mirrors. After a new apt-get update, I see the following:

$ apt-get install -yq git E: Unable to locate package git 

After a few apt-get , it will often be successful.

+6
source share
2 answers

The mirrors still seem to be broken, but I was able to get around the problem with a dumb loop:

 # stupid loop to get around ubuntu package mirror problems for attempt in 1 2 3; do if [ ! -z "`which git`" ]; then break fi echo "Trying to install git, attempt $attempt" sudo apt-get update -yq --fix-missing sudo apt-get install -yq git done 

3 attempts are usually enough to find a working mirror.

+10
source

Update apt-get packages, run the following command:

 $ apt-get update 
+17
source

Source: https://habr.com/ru/post/925472/


All Articles