问题
I'm trying to clone my fork of the kivy git, but it's not working. I've made the fork correctly, I believe, but when I type this into my Mac terminal:
git clone https://github.com/mygitusername/kivy.git
I get this error:
fatal: could not create work tree dir 'kivy.: Permission denied
Anyone see what I am doing wrong? Thanks!
回答1:
You should do the command in a directory where you have write permission. So:
cd ~/
mkdir code
cd code
git clone https://github.com/kivy/kivy
For example.
回答2:
Your current directory does not has the write/create permission to create kivy
directory, thats why occuring this problem.
Your current directory give 777 rights and try it.
sudo chmod 777 DIR_NAME
cd DIR_NAME
git clone https://github.com/mygitusername/kivy.git
回答3:
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 >
回答4:
If you are working in Windows you have to change the permissions of the directory putting full permissions or just write to let github clone the repository. The steps are 1. Go To your directory 2)open properties 3) go to tab "security" 4) change the permissions 5) apply
回答5:
For other Beginners (like myself) If you are on windows running git as admin also solves the problem.
回答6:
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.
回答7:
I had the same error on Debian and all I had to do was:
sudo su
and then run the command again and it worked.
回答8:
This does happened also when you are cloning a repo without selecting any working directory. just make sure you did cd
into your working directory and i believe it will work just fine.
回答9:
Just run the application by selecting Run as Administration.
Thank you.
回答10:
All you need to do is Run your terminal as Administrator. in my case, that's how I solve my problem.
回答11:
sudo chmod 777 DIR_NAME
cd DIR_NAME
git clone https://github.com/mygitusername/kivy.git
should work fine
来源:https://stackoverflow.com/questions/16376035/fatal-could-not-create-work-tree-dir-kivy