aws codecommit repo 文件夹被本地计算机上的 git 命令 运行 覆盖

aws codecommit repo folder override by git command run on local computer

在本地计算机和 AWS codecommit 存储库中有一个名为 profileimg 的文件夹名称。当用户上传图像时,该文件夹会充满图像。但是,当我更改本地计算机存储库中的一些代码并 git 推送到远程存储库(AWS codecommit 存储库)时,profileimg 文件夹覆盖空数据和图像正在消失。这是在 AWS beantalk 环境中托管的 Laravel 8 项目。

到目前为止我在本地 git 存储库中尝试的内容:

文件夹结构:

.git忽略

#exclude everything
public/images/profileimg/*
public/images/profileVerifyDoc/*

#exception
!public/images/profileimg/.gitkeep
!public/images/profileVerifyDoc/.gitkeep


此外,我在 AWS codecommit 存储库中创建了 .ebignore 文件。本地计算机也有 .gitignore 文件。任何建议,请。

在 profileimg 中创建一个名为 .gitkeep 的空文件,然后在你的 .gitignore 文件中写入:

# exclude everything
profileimg/*

# exception to the rule
!profileimg/.gitkeep 

已创建 profileimg 文件夹以存储随时间变化的用户图像。当我向代码库添加新更改并将它们 git 推送到 AWS Beanstalk 环境时,现有文件和文件夹将替换为新更改。解决方案是创建一个 S 3 存储桶或将图像保存在单独的位置。

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.concepts.design.html