Does Gitlab support git archive --remote=

I’ve tried:

git archive --remote=https://xyz.com/mosaic/widget.git -o test.zip HEAD:app/

And received this in response:

fatal: Operation not supported by protocol.

I also tried:

git archive --remote=ssh://xyz.com/mosaic/widget.git -o test.zip HEAD:app/

And received this in response:

ssh: connect to host xyz.com port 22: Connection timed out fatal: The remote end hung up unexpectedly

My first question is whether Gitlab supports this operation, and if so, what changes to the command and/or configuration are required?

Hey there Greg,

Gitlab does in-fact support the use of git archive. I was able to do this successfully via SSH - example below.

git archive --remote git@gitlab.com:gitlab-org/distribution/team-tasks.git -o test.zip HEAD

The above example uses the public repo here. The format for your SSH connection should be as follows:

git@<hostname>:path/to/project.git

You can also clone the needed URL via the project directly, by clicking on the clone button in the top right and selecting the SSH URL.

Also, would you mind trying this out without the ‘:app/’ appended to the end? I’m not really sure what this is doing. It doesn’t look like this is something that is used often, the above information took a bit of time to find.

1 Like

Hey Greg,

Did this end up working out for you?

1 Like

I sorry for the delayed response, and that my response won’t be helpful. I abandoned the approach I was taking and took a more conventional one. Thank you, though, for your thorough reply.

Caleb, I was stumble upon the same command on my own; however, the MODE on files are too high. I would like to figure out how to set the CONFIGURATION item, tar.umask, as identified in the manpage for git-archive.

Where do I do that? Can it be done on the command-line?

In the manpage for git-archive it explicitly states this:
CONFIGURATION
tar.umask
This variable can be used to restrict the permission bits of tar archive entries. The default is 0002, which turns off the world write bit. The special value “user” indicates that the archiving user’s umask will be used instead. See umask(2) for details. If --remote is used then only the configuration of the remote repository takes effect.

Thanks,
Warron