微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决aws codecommit repo 文件夹由在本地计算机上运行的 git 命令覆盖

在本地计算机和 AWS 代码提交存储库中有一个名为 profileimg文件夹。当用户上传图像时,该文件夹会填充图像。但是,当我更改本地计算机存储库中的一些代码并将 git push 放入远程存储库 (AWS codecommit repo) 时,带有空数据和图像的 profileimg 文件夹覆盖将消失。这是一个托管在 AWS beanstalk 环境中的 Laravel 8 项目。

到目前为止我在本地 git repo 中的尝试:

  • $ git rm -r --cached public/images/profileimg/*
  • $ git update-index --assume-unchanged public/images/profileimg/*

文件夹结构:

.gitignore

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

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

enter image description here

enter image description here


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

解决方法

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

# exclude everything
profileimg/*

# exception to the rule
!profileimg/.gitkeep 
,

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

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。