簡體   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