bash git clone 致命:无法创建工作树目录权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36728469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git clone fatal: cannot create work tree dir permission denied
提问by Redrield
so I'm trying to clone a repository from git, into a folder i know I have write access in.
所以我试图从 git 克隆一个存储库,到我知道我有写访问权限的文件夹中。
I'm trying to clone it using IntelliJ's built in VCS capabilities, and the git bash program from git-scm.com Both of them return the following error:
我正在尝试使用 IntelliJ 的内置 VCS 功能和来自 git-scm.com 的 git bash 程序克隆它,它们都返回以下错误:
fatal: could not create work tree dir '<repo name>' :
Permission denied
What am I doing wrong?
我究竟做错了什么?
回答by CodeWizard
The error is pretty simple. You don't have permissions on the given directory.
错误很简单。您没有给定目录的权限。
You can do several things but the most simple one is to try and clone the repository vi git bash
您可以做几件事,但最简单的一件是尝试克隆存储库 vi git bash
# 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>
Once you have cloned the project - open it in IntelliJ's.
克隆项目后 - 在 IntelliJ 中打开它。
回答by Naveen Ram
One thing is very clear that you don't have permissions on the given directory. So either you can do cloning or simply run the application by selecting Run as Administrationas shown in the image.
有一点很明显,您没有给定目录的权限。因此,您可以进行克隆,也可以通过选择“以管理身份运行”来简单地运行应用程序,如图所示。
Later on, you can use git clone https://github.com/forcedotcom/EMP-Connector.git
稍后,您可以使用 git clone https://github.com/forcedotcom/EMP-Connector.git
Thank you.
谢谢你。
回答by Prashant Gonga
After you have checked the directory permission (make sure you've got write access) try the below steps:
检查目录权限后(确保您有写权限),请尝试以下步骤:
cd ~/
mkdir code
cd code
git clone https://github.com/repo-name