How do I export a specific commit with git-archive?

前端 未结 2 1181
太阳男子
太阳男子 2020-12-13 14:54

I asked a similar question before, but it was answered inadequately so I thought I would ask again here but providing more information. I need to get different and older ver

相关标签:
2条回答
  • 2020-12-13 15:22

    The Problem

    In both your examples, you are exporting the tip of master. Take out your flags and arguments, and you have:

    git archive master
    

    In other words, you're explicitly doing this to yourself by specifying whatever is stored in .git/refs/heads/master as your tree-ish.

    The Solution

    You need to provide a tree-ish in accordance with gitrevisions(7) if you want to export a different commit. For example, to export commit 29435bc, you could specify:

    git archive --format zip --output /full/path/to/zipfile.zip 29435bc
    
    0 讨论(0)
  • 2020-12-13 15:35

    Resolution

    This is an expected behaviour for the newest versions of Git. Remote Git repositories do not allow clients to access arbitrary SHA1s. The requested objects should be accessed by a ref (i.e. file name).

    git-upload-archive-archiver-died-with-error

    0 讨论(0)
提交回复
热议问题