Errors Occurrs Each Time "GIT pushing" to remote.

Hello everyone,

I encounter two issues with my laravel web app each time I “git push” to the server. Everything works fine on the local machine (Mac). I am running nginz server on DigitalOcean.

1- Each time I “git push” to remote, all the pictures only the website get broken. The only way I solve this is, cd to public/storage, delete the storage folder and then run php artisan storage:link. This is tedious because I have to do it every time I “git push” to remote.

2- Each time I “git push” to remote and when I try to updating/populating any of my tables, I receive this error after the table has been updated/populated: (1/1) PDOException SQLSTATE[HY000]: General error: 8 attempts to write a readonly database

Sinc,e I am using TNTSearch package, I notice it tries to write to the index file. I figured out that I need to give permission to the database, so I solve this issue using: chmod -R 0777 /path/to/index . This solves the problem but it recurs when I “git push” to the remote.

How can I give a permanent write permission to public/storage (in the first case) so that I do not have to run the command each time I push to remote? Also, How do I give a permanent write permission to the database, so that I do not have to do that each time I push to remote?

Thank you in advance.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

If you have specific tasks that must be completed (e.g. running php artisan storage:link) after each push to your production server, you might consider using git hooks to automate them. Placing a script at .git/hooks/post-receive will cause it to run on the git remote each time it receives a push.

Find out more details about using git hooks in this tutorial: