I have a CI process that runs a build
process on my application which does things like minimizing code, obscufating etc and it outputs the result into a /build
folder within my project.
I have added the /build
path to my .gitignore to avoid duplication of code in the repository.
However I want to zip the /build project and upload it to my server, however when I run:
git archive --format=zip HEAD ./build > deploy.zip
I get an error message:
"fatal: current working directory is untracked"
I've tried:
- using a more generic
zip -r ./deploy.zip . -x "**node_modules**"
- this works however I'm wondering if there's a way to use thegit archive
command instead? - using the --add-file option e.g.
git archive --format=zip --add-file=build/ HEAD ./build/ > deploy.zip
CodePudding user response:
Since your build/
directory is not versioned in git (note: which is a perfectly reasonable thing to do), it makes sense to use a non git command to create an archive with that content.
You worded, in your comment, your concerns with using a standard command : I would argue that creating a .zip
or .tar.gz
file is even "more" standard. git
simply relies on these standards (and specific libraries that implement them).