Search code examples
gitgitignoregit-flowgit-logaws-codecommit

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

enter image description here

enter image description here


Moreover, I created .ebignore file in the AWS codecommit repo. The local computer also has .gitignore file. Any suggestion, please.

Solution

  • 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