在 bitbucket 中推送代码删除服务器文件

Pushing codes in bitbucket delete server files

我正在使用 Laravel Forge 并将其连接到 Envoyer,当我将代码推送到 bitbucket master 分支(连接到实时服务器)时,它会删除所有用户文件(例如用户个人资料图片和 . ..).

我每次都尝试 .gitignore 两种不同的格式:

/public/images/profile/*
#and
/public/images/profile/

但是用户的图片还是被删除了。
谁知道如何防止删除文件夹中的图像?

每次部署时,Envoyer 都会使用您存储库中的新代码创建新目录。您的文件并没有真正删除,那些文件仍在服务器上之前的部署文件夹中。

要解决此问题,请将用户文件放在 storage 目录中。然后转到 Envoyer -> Deployment Hooks -> Manage Linked Folders 并添加以下内容:

此处有更多详细信息 - https://envoyer.io/docs

Deployment Lifecycle

When a deployment is triggered for your project, Envoyer will execute your deployment plan. By default, this consists of downloading a tarball of your project, installing the Composer dependencies, pointing the current symbolic link at the latest release, and finally purging any old deployments from your server.

Managing Uploaded Files

When storing user uploaded files, you should store them in the storage directory of your application if you are using Laravel. Then, you may use the "Manage Linked Folders" feature of Envoyer to create a symbolic link from your public directory to the storage directory. The "Manage Linked Folders" button can be found on the "Deployment Hooks" tab of your project.

If you are not using Laravel, you will essentially follow the same process. However, you will need to manually create a storage directory in the deployment path of your application (the same directory level as the current symbolic link).