当前位置:   article > 正文

在ubuntu下安装git时遇到的问题记录_apt-get install git: command not found

apt-get install git: command not found

 问题:

用root账号登录时,使用 apt-get install git命令安装git时,报错如下

  1. Command 'apt-get' is available in '/usr/bin/apt-get'
  2. The command could not be located because '/usr/bin' is not included in the PATH environment variable.
  3. apt-get: command not found

切换到普通管理员账号登录,使用sudo apt-get install git安装git安装成功

再切换到root,git --version查看git版本,仍然报错

  1. root@alibaba:~# git --version
  2. Command 'git' is available in '/usr/bin/git'
  3. The command could not be located because '/usr/bin' is not included in the PATH environment variable.
  4. git: command not found

查找得报错原因为apt-get不在/usr/bin下

解决方法:

使用root账号登录

输入以下代码:

  1. root@alibaba:~# cd /bin/
  2. root@alibaba:/bin# PATH="$PATH:/usr/bin"
  3. root@alibaba:/bin# export PATH
  4. root@alibaba:/bin# apt-get install vim

回车后显示如下图

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/726289
推荐阅读
相关标签
  

闽ICP备14008679号