Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when using git bash

I would want to know what is this Git error at the start of Git bash ?

chmod: changing permissions of '/dev/mqueue': Permission denied
ln: failed to create symbolic link '/etc/mtab': Permission denied
'C:\WINDOWS\system32\drivers\etc\hosts' -> '/etc/hosts'
/usr/bin/cp: cannot create regular file '/etc/hosts': Permission denied
'C:\WINDOWS\system32\drivers\etc\protocol' -> '/etc/protocols'
/usr/bin/cp: cannot create regular file '/etc/protocols': Permission denied
'C:\WINDOWS\system32\drivers\etc\services' -> '/etc/services'
/usr/bin/cp: cannot create regular file '/etc/services': Permission denied
'C:\WINDOWS\system32\drivers\etc\networks' -> '/etc/networks'
/usr/bin/cp: cannot create regular file '/etc/networks': Permission denied
rm: cannot remove '/etc/post-install/01-devices.post': Permission denied
rm: cannot remove '/etc/post-install/03-mtab.post': Permission denied
rm: cannot remove '/etc/post-install/06-windows-files.post': Permission denied
rm: cannot remove '/etc/post-install/99-post-install-cleanup.post': Permission denied
like image 496
Omkar Mulick Avatar asked Feb 21 '20 06:02

Omkar Mulick


People also ask

How do I fix bash permission denied?

Solution to fix the bash: ./program_name: permission denied error. chmod u+x program_name– In this line, the chmod command will change the access mode to execute, denoted by x. only the file's owner will have the permission to execute the file.

How do I fix permission denied error?

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.


2 Answers

See https://github.com/git-for-windows/git/issues/1449. This happens when the post-install scripts fail to run for some reason.

Running Git Bash as administrator once triggers execution of those scripts and fixes the problem.

like image 165
sur5r Avatar answered Oct 18 '22 17:10

sur5r


Yes, this happened to me after downloading Git for Windows 2.29.0, post-install scripts failed, and running it as admin once allows the chmod command to work and permanently fixes the problem! I would like to add: this may happen to every update that Git Bash has; you just have to occasionally run Git as administrator (right after finishing update) for the scripts to run!

like image 5
SuperHarmony910 Avatar answered Oct 18 '22 18:10

SuperHarmony910