I can use the chrome browser to download the ZIP file of a private gitea repository https://someurl.com/mydir/archive/master.zip after entering username and password.
I try to use curl to download the same ZIP file.
I followed gitea API:
and tried:
curl -XPOST -H "Content-Type: application/json" -k -d '{"name":"test"}' -u username:password https://gitea.your.host/api/v1/users/<username>/tokens
curl --request GET --url https://yourusername:password@gitea.your.host/api/v1/users/<username>/tokens
Both curls were successful.
Then I tried:
curl --location-trusted --user myusername:mypassword --request GET -H "Authorization: token 16c3e37d" -O --url https://someurl.com/mydir/archive/master.zip
I got this file, its size is much smaller than the expected file size.
Its content, edited for brevity, is:
<form class="ui form" action="/user/login" method="post">
<input type="hidden" name="_csrf" value="MPetQDF">
<div class="required inline field">
<label for="user_name">Username or Email Address</label>
<input id="user_name" type="text" name="user_name" value="" autofocus required>
</div>
<div class="required inline field">
<label for="password">Password</label>
<input id="password" name="password" type="password" value="" autocomplete="current-password" required>
</div>
</form>
<a href="/api/swagger">API</a>
<script src="/assets/js/index.js?v=a30bc3"></script>
How to proceed further?
Please help.
Thanks.