前言
今天在git上down代码的时候提示:fatal: could not create work tree dir ‘xxxx’: Permission denied
叙述
出现这个错儿的主要原因就是因为:The directory in which you are trying to write the file or taking the clone of git repository, it does not has the write permission. That’s why this problem is occurring.
Please change the write permission of directory.
Then clone the repository.(一句话说白了就是没有权限)
解决方案1:
#此方法已验证
# go to any other directory where you have the permissions to write to
cd <some path>
# Check to see if you have permissions:
mkdir dummy
# Now once you have verified that you have write permissions -
# clone the project from the command line
git clone <url>
解决方案2:
In my case what happened was that the user I was using had no ownership over the directory. I simply had to change ownership of the directory to that user. For example if user is ubuntu:
#此方法未验证
chown ubuntu:ubuntu -R directory-in-question
cd directory-in-question/
git clone <git repo comes here >
黑色背景 |
小结
不积跬步无以至千里
感谢您的阅读~~