简体   繁体   English

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

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

There was a folder name called profileimg in the local computer and the AWS codecommit repository.在本地计算机和 AWS codecommit 存储库中有一个名为profileimg的文件夹名称。 That folder fills with images when a user uploads images.当用户上传图像时,该文件夹会填充图像。 However, when I change some code in the local computer repo and git push into remote repo ( AWS codecommit repo ), profileimg folder override with empty data and images are being disappeared.但是,当我更改本地计算机存储库中的一些代码并将 git 推送到远程存储库(AWS codecommit repo)时,带有空数据和图像的profileimg文件夹覆盖正在消失。 This was a Laravel 8 project hosted in the AWS beanstalk environment.这是一个托管在 AWS beanstalk 环境中的 Laravel 8 项目。

What I tried so far in the local git repo:到目前为止,我在本地 git 存储库中尝试了什么:

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

Folder structure:文件夹结构:

  • public上市
    • images图片
      • profileimg轮廓图像
  • .gitignore .gitignore

.gitignore .gitignore

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

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

在此处输入图像描述

在此处输入图像描述


Moreover, I created.ebignore file in the AWS codecommit repo. 此外,我在 AWS codecommit repo 中创建了 .ebignore 文件。 The local computer also has.gitignore file. 本地计算机也有.gitignore 文件。 Any suggestion, please. 有什么建议,请。

Create an empty file called.gitkeep inside profileimg, then in your.gitignore file write:在 profileimg 中创建一个名为 .gitkeep 的空文件,然后在您的 .gitignore 文件中写入:

# exclude everything
profileimg/*

# exception to the rule
!profileimg/.gitkeep 

profileimg folder has created to store user images that are changing over time. profileimg 文件夹已创建用于存储随时间变化的用户图像。 When I added new changes to the code base and git push them to the AWS Beanstalk environment, the existing files and folders getting replace with the new changes.当我向代码库添加新更改并将 git 推送到 AWS Beanstalk 环境时,现有文件和文件夹将被新更改替换。 The solution is to create an S 3 bucket or save the images in a separate location.解决方案是创建一个 S 3 存储桶或将图像保存在单独的位置。

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.concepts.design.html 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