Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git gives me a "Permission Denied" error when writing files that I am pulling

On my Windows machine, when I pull my repo I get:

error: unable to crate file <path to file> (Permission denied) 

I think the problem might be that when I look at the properties of the folder there is a square inside the checkbox, I clear it out so that no files or folders will be read only.

After pressing ok and checking to see if Windows applied my changes, I see the square again!

How can I get Git or Windows to allow me to get my commits?

like image 749
rp. Avatar asked Feb 08 '12 20:02

rp.


People also ask

How do I fix Permission denied in git?

In terminal enter this command with your ssh file name pbcopy < ~/. ssh/id_rsa. pub This will copy the file to your clipboard Now open you github account Go to Settings > SSH and GPG keys > New SSH key Enter title and paste the key from clipboard and save it. Voila you're done.

How do I fix error denied permissions?

Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions that you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.

Why do I get permission denied in Git bash?

Conclusion. The Bash permission denied error indicates you are trying to execute a file which you do not have permission to run. To fix this issue, use the chmod u+x command to give yourself permissions. If you cannot use this command, you may need to contact your system administrator to get access to a file.

Why is it showing permission denied?

This error occurs when the user does not have the privileges to make edits to a file. Root has access to all files and folders and can make any edits. Other users, however, may not be allowed to make such edits. Remember that only root or users with Sudo privileges can change permissions for files and folders.


2 Answers

Run the Git Bash or the console you are running, with Run As Administrator

like image 123
manojlds Avatar answered Oct 03 '22 02:10

manojlds


Check if another application is using your files and kill it. In my case it was grunt, always watching for the changes and building project. Gave me the same message as yours, when discarding files.

How it happened? When I've switched to another branch, some non-existent files appeared in my working copy. I could not Discard them, nor open in the text editor.

like image 23
Volodymyr Kotylo Avatar answered Oct 03 '22 04:10

Volodymyr Kotylo