简体   繁体   中英

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. 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. This was a Laravel 8 project hosted in the AWS beanstalk environment.

What I tried so far in the local git repo:

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

Folder structure:

  • public
    • images
      • profileimg
  • .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. The local computer also has.gitignore file. Any suggestion, please.

Create an empty file called.gitkeep inside profileimg, then in your.gitignore file write:

# exclude everything
profileimg/*

# exception to the rule
!profileimg/.gitkeep 

profileimg folder has created to store user images that are changing over time. 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. The solution is to create an S 3 bucket or save the images in a separate location.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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