Git auto-deploy from Webhook giving permissions error?
Hi all. I have an Ubuntu server which I want to update whenever new code is pushed to a remote repository. I can successfully run a “git pull” from the command line when I Putty into the server and am at the file location. I have code working to verify the secret key is correct, but I can’t seem to get the code to execute “git pull” successfully. It returns the following error:
“error: cannot open .git/FETCH_HEAD: Permission denied”
This makes me think that the “user” (the script being run) doesn’t have permission to access git? Because I can manually run “git pull” from the directory in Putty successfully, but when using PHP and putting shell_exec(‘git pull’), it returns that error.
I assume the solution needs to involve setting user permissions in the line before calling git pull. But I’m unsure what this shell snippet code should be.
Thanks every much for your help, I’m brand new to Digital ocean, and cloud computing in general.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×