Execute the command directly:
apt install git
Copy the code
The apt package list needs to be updated if the following errors occur during installation
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package git is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'git' has no installation candidate
root@iZ8vbh829ac9d7go2fq5otZ:~# git -V
Command 'git' not found, but can be installed with:
apt install git
Copy the code
Update apt package list:
apt-get update -y
apt-get upgrade -y
Copy the code
Run apt install git after the update
Finally, run git –version to check whether Git is successfully installed
Read the text: Essays by Xiaoxin