繁体   English   中英

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

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

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

到目前为止,我在本地 git 存储库中尝试了什么:

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

文件夹结构:

  • 上市
    • 图片
      • 轮廓图像
  • .gitignore

.gitignore

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

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

在此处输入图像描述

在此处输入图像描述


此外,我在 AWS codecommit repo 中创建了 .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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM