3

Trying to create an archive for deployment, but I'm getting an error. No idea why -- I've done other deployments using this same line.

git archive --format=zip --output=filename.zip HEAD:www 
2
  • 2
    Is www a top-level directory in the current HEAD revision of the repo? (To clarify: I'm suspecting that when you ran this before, such a directory existed. But this time, is it a different repo with different structure; or was the directory removed or renamed? If so HEAD:www would no longer be a valid tree-ish.) Commented Jun 1, 2017 at 19:27
  • That was it. My other scripts used separate repos for client/server/app stuff, but I put this new one in a single repo. Thanks! Commented Jun 1, 2017 at 19:53

2 Answers 2

3

Just in case anyone else stumbles across this while googling, for me the problem was a bad parameter to git archive and it was trying to interpret the bad parameter as the "tree-ish".

I forgot the -- in front of my output=blah.zip so it was trying to find the tree "output=blah.zip".

Sign up to request clarification or add additional context in comments.

Comments

1

Well in my case it is a missing parameter, it interprets the first name ofter output as the ref to base the archive on.

wrong:

git archive -o /c/work/220402_PX_Integrate_P4TA.zip $(git diff --name-only 220402_Testmerge_prep_P4TA..PX_Integrate_P4TA) 

gives you the error:

fatal: not a valid object name: codeunit/codeunit_0000000002.txt

which is the first return value from git diff, but not a ref, it's a file.

working:

git archive -o /c/work/220402_PX_Integrate_P4TA.zip HEAD $(git diff --name-only 220402_Testmerge_prep_P4TA..PX_Integrate_P4TA) 

The first parameter is now HEAD, the current tip of the repository. Still should be the version you want to export, though.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.