My question is very similar, to another very old question (Download GitHub .zip without Repository's name folder), which was closed without a solution that works for me.
So I write a fresh question, with all information, I already could gather.
I'd like to find a way to download zip files (of any state of the projects) from GitHub / GitLab repositories. Currently you CAN download .zipfiles from GitHub and GitLab repositories via Code -> Download zip
My Problem in the current state is, that the archives always contain a folder with repository name and branch at the top level e.g.
master.zip
- myRepo-master
- README
- other file in repo root
But e.g. for minecraft datapacks, resourcepacks or mods etc. you need to have a fixed structure, what means the zipfile can not be used with this root folder and always must be repacked, before in could be used.
From GitHub Docs - Downloading Archives I know, that the archive function is created via the git archive command.
I already could modify the contents of the archives using a .gitattributes files in my repo (read more about this at git-scm - Git Archive - Attributes )
Unfortunately I could not find a way a configuration to avoid this folder in the root of the zip-file.
I found some workarounds for this issue e.g.
- to add my downloads as Releases, but the always requires Manually adding a new Version and repacking the zipfile
- or several pages like e.g. DownGit
But nothing of this is what I want. I want to configure my own repository that
- the archive that you can download foreach state of the project is packed without root folder
- OR that I have a native URL to GitHub or GitLab, where you could download a archive (without root folder) directly without 3rd party pages
So the Question is: Can anybody give some helpful information how to change the download behavior in GitLab / GitHub to get an archive without root folder?
My biggest hope was to find using .gitattribues to exclude files and the parent folder.
Excluding files or subfolders already works like you can see at my bundle-recipe Datapack.
Has anyone helpful ideas to exclude the top folder too?