安装git提示E: Package ‘git‘ has no installation candidate

环境:
ubuntu 18.04

问题:
在进行linux系统上安装git时提示

E: Package 'git' has no installation candidate
root@iZbp1ibvmgmcwwjt2gtphvZ:~# apt install git
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用户的话建议加上sudo

解决:
对系统进行更新升级,升级成功之后使用git命令 git --version进行版本查看

root@iZbp1ibvmgmcwwjt2gtphvZ:~# apt-get update
root@iZbp1ibvmgmcwwjt2gtphvZ:~# git --version
git version 2.17.1

你可能感兴趣的:(问题解决,linux,git)