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/
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With