1

I have added node_modules in .gitignore as usual, because I want to keep it out of my repository. However, I use git archive to create a production ZIP that I upload to AWS Elastic Beanstalk and I want to include the node_modules so that they don't have to be installed on the EC2 instance, because it has very limited resources.

I looked at .gitattributes and I know I can use export-ignore to exclude a folder that is not present in .gitignore, but here I want to do the opposite. I didn't find anything in the git archive docs. Is this possible?

dodov
  • 5,206
  • 3
  • 34
  • 65
  • You can use the --worktree-attributes flag with the git archive command. In your case " git archive --format zip --output archive.zip HEAD --worktree-attributes " – dostogircse171 Mar 05 '23 at 22:38
  • Yeah, `--worktree-attributes` does something else. Seems like someone has asked this question before, just with a different point of view and wording. **tl;dr** it's not possible. – dodov Mar 06 '23 at 05:34

0 Answers0