It seems like the issue you're encountering is related to file permissions and ownership. When you create files locally, they are owned by your user (jeff) and your group (jeff or www-data), but when these files are pulled onto the server, they need to be accessible by the web server user (often www-data or similar).
Here are a few steps to ensure proper permissions and ownership:
-
Set the correct ownership: Make sure that the files and directories in your Laravel project are owned by the correct user and group. On your local machine, you can set the group to
www-data(or whatever group your web server uses) and give group write permissions.sudo chown -R jeff:www-data /path/to/your/laravel/project sudo chmod -R g+w /path/to/your/laravel/project -
Set the correct permissions for storage and bootstrap/cache directories: Laravel requires specific directories to be writable by the web server. You can set these permissions as follows:
chmod -R 775 /path/to/your/laravel/project/storage chmod -R 775 /path/to/your/laravel/project/bootstrap/cache -
Use umask to set default group permissions: You can set a
umaskin your.bashrcor.bash_profileto ensure that new files are created with group write permissions by default.echo "umask 002" >> ~/.bashrc source ~/.bashrc -
Configure git to handle file permissions: Git has a configuration called
core.fileModewhich tells Git if it should track file permission changes. If your server admin is having to constantly fix permissions, you might want to set this tofalsein your local repository.git config core.fileMode false -
Use a deployment script: If the server admin is pulling your code, consider using a deployment script that sets the correct permissions after each pull. This script could reset the permissions to what the server expects.
-
Communicate with your server admin: Since the server admin has to deal with multiple developers, it might be helpful to establish a common set of permissions and ownership that all developers should use. This way, you can configure your local environment to match the server's expectations.
Remember to replace /path/to/your/laravel/project with the actual path to your Laravel project. Also, be cautious with permissions: giving too broad permissions can be a security risk. Always aim for the principle of least privilege.
Lastly, ensure that your .gitignore file is properly set up to ignore the storage and bootstrap/cache directories, as these should not be tracked by Git and should be generated on the server side.