git clone fatal: cannot create work tree dir permission denied
Solution 1
Use sudo
sudo git clone <url>
Solution 2
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
# 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.
Solution 3
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
Solution 4
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 Administration as shown in the image.
Later on, you can use git clone https://github.com/forcedotcom/EMP-Connector.git
Thank you.
Related videos on Youtube

Redrield
Updated on July 05, 2022Comments
-
Redrield 11 months
so I'm trying to clone a repository from git, into a folder i know I have write access in.
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:
fatal: could not create work tree dir '<repo name>' : Permission denied
What am I doing wrong?
-
Redrield about 7 yearsAlright, I figured out what was wrong, the folder that shared a name with the repo had read only on it. But when I tried to change the attributes I was denied permission, even with admin, will I need to make a linux live cd just to remove that folder or what?
-
Andreas Louv about 7 years
chmod 644 [directory]
andchown user:group [directory]
? -
Redrield about 7 yearschmod gives me permission denied, even as administrator, chown says it can't perform the operation because it is a directory
-
CodeWizard about 7 years
sudo chmod ...
orsudo chown <user> ...
-
Redrield about 7 yearsAfter much pain with Windows' horrible everything I figured it out. chown chose to work my second time around, thanks!
-
-
Ilya Sazonov about 2 yearsAs far as I understand OS in the question is not windows
-
joanis about 2 yearsGit Bash is a Windows thing, so I think the OS in indeed Windows.