Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bare repository permissions.

I setup git on an ubuntu server and I was pushing the local repo to the server and getting the errors below. When I change the permissions of the two folders it works. I just want to understand why when I setup git init --bare it doesn't just work with the permissions it creates. Also is 777 the best permissions to have for these folders? Is there a more legit way of fixing this?

The first error:

error: insufficient permission for adding an object to repository database ./objects

The first solution:

sudo chmod 777 objects/

The second error:

fatal: Unable to create '/srv/git/example.com.git/refs/heads/master.lock': Permission denied

The second solution:

sudo chmod 777 refs/heads/
like image 967
ThomasReggi Avatar asked Jun 22 '12 17:06

ThomasReggi


1 Answers

Running

$ git init --shared=0777 --bare

should do what you want.

From http://git-scm.com/docs/git-init

Alternatively, you could set up an openssh server on your server and have users access this repository through ssh.

like image 145
Kent Avatar answered Sep 28 '22 16:09

Kent