Evangelos
Evangelos

Reputation: 279

Error with git over https push to remote server fatal could not switch to :permission denied

I have a problem that cannot solve for days now and it's eating me what could be wrong.

I've set up a git server on Centos 7 machine.I 've also set up git over https. Everything is working fine.I created post receive hook to checkou to path/to/repo but when i try to push to remote Server(Centos) i get the following error.

remote: fatal: Could not switch to 'path/to/repo' : Permission denied.

I have tried everything change permisssions, owners gave 0777 to both the repo and path/to/repo files and folders with no luck.

The funny thing is that i've set up a vm on my machine with git server to test it first before going to the production and is working fine with no problems after i changed permissions.

But on when i set the production the same way i get

remote: fatal: could not switch to /path/to/repo: Permissions Denied 

tested with root user and a test user and with permissions to 0777 to see if it will work changed owners groups(test,root,apache) but with no luck.I even restarted the server.

It's like permissions are not changing

Does anyone have any idea what might be the problem?

Thank you.

Upvotes: 2

Views: 535

Answers (1)

Evangelos
Evangelos

Reputation: 279

Solved it.

After trying everything found out that the problem was with the permissions to /home/user directory.Only root has permissions to home directories by changing that it worked.Just by adding +x for others to the home of the user where the repo is pushing (0701) it worked.

Upvotes: 2

Related Questions