Download a specific repo branch with curl or similar

Hi,

I’m trying to automate APK (Alpine) packages building according to Creating an Alpine package - Alpine Linux and some HOWTO at how to download archive of private repository? · Issue #9224 · go-gitea/gitea · GitHub

What I see there is that you need to curl -X GET the master branch, and it compresses as .zip

Is there an API way to download a specific repo branch, in tar.gz ? I might have missed it in the doc, for some reason. I need to download the branch under a specific user which has its own auth token in gitea.

Also, I forgot: the gitea user might not be the same as the unix user (gitea user has its own auth token registered in the gitea server)