Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ubuntu git init permission denied

Tags:

git

ubuntu

I guess I have a problem with my rights.
I have a nearly new Ubuntu 14.04 installed and just configured my vhost to display my little html project. The new site has no problem to work correctly in the Firefox.

But now I want to initialize a new git repo and failed.
When I type inside /var/www/html

git init  

I get this error

/var/www/html/.git: permission denied 

My /var/www has these permissions:

drwxrwxr-x 13 www-data www-data 4096 Jan  4 18:48 html/ 

When I type

ssh-add -l  

my id_rsa(RSA) is displayed correctly.

I have no clue what else I missing here. :-(

like image 716
Timo.Klement Avatar asked Jan 11 '15 16:01

Timo.Klement


1 Answers

Your /var/www folder permissions only permit writing files for the www-data user and members of the www-data group. You can add yourself to the www-data group with the following command

usermod -a -G www-data your_username

If you're logged in over SSH you will need to logout and then back on.

That should allow you to write files in that folder without having to give everyone write permissions. Doing so is not a good idea on a production server.

like image 90
Ding Avatar answered Sep 24 '22 07:09

Ding