git init Permission denied – /private/etc/apache2
On OS X 10.10, I would like to use git with my apache in private/etc/apache2 directory. When I try to run
git init I get
Permission denied. What would a best practice be to add the appropriate permissions on this directory to enable git usage?
- CocoaPods failing to install from GitHub with “No such file or directory” error
- Git on Yosemite keeps asking for remote username and password
- Why can't git read my certificate file in Yosemite?
- Git Clone Fails with sslRead() error on OS X Yosemite
- GIT SSL error persist despite recommended fix for Mac OS X Yosemite
- Should foo.xcodeproj/xcuserdata be ignored in git repo?
2 Solutions collect form web for “git init Permission denied – /private/etc/apache2”
The Permission denied is generally a file permission issue, where git doesn’t have permissions to write.
One option is to run your
git init etc with
sudo, i.e., as
sudo git init (though this is not recommended)
You could also create a new user and a new group, add your web server user to that group and initiate
git init with this user. Another alternative is to add yourself to the apache group using
As it is about to
Permission Denied and @mu also mentioned about to use the
Give the permission of the folder to the
user by the following command –
$ chmod u+x /private/etc/apache2