Use git --version
to see the version
[www@i001 ~]$ git --version
git version 2.8.0
But when I want to clone something, it turns out to be git: command not found
. What’s going on?
[www@i001 ~]$ sudo -Hu www git clone https://git.coding.net/msiaxxxx/test001.git /home/wwwroot/test001 --depth=1
sudo: git: command not found
After adding the git installation path, execute
[www@i001 ~]$ sudo -Hu www /usr/local/git/bin/git clone https://git.coding.net/msiaxxxx/test001.git /home/wwwroot/ --depth=1
fatal: could not create work tree dir '/home/wwwroot/test001': Permission denied
is Permission denied
, and the same thing happens when you switch to root user.
Have you installed it? It should not be installed, right?
If you try to type
git
看会得到什么,如果还是not found
directly, it means it is not installed. Normally, mine will output:Why use
sudo
来clone
?sudo /usr/bin/git clone xxxxx