fatal: could not create work tree dir ‘xxxx’: Permission denied

1. 在执行git clone的时候,报错fatal: could not create work tree dir 'sw_home': Permission denied,如下所示:

poweruser@ubuntu-cuda-26-2:/opt$ git clone --recursive ssh://xxxxxxxx/sw_home.git
fatal: could not create work tree dir 'sw_home': Permission denied

2. 主要原因在于当前/opt目录下,没有写权限


drwxr-xr-x   2 root root       4096 Jun 30 01:40 opt/

使用chmod增加写入权限

cd ..
sudo chmod o+w /opt

而后再回到/opt目录,再进行git clone即可成功

你可能感兴趣的:(git,git)