Hello,
can you please advise how to create a repository from any server that is not hosting gitea?
I have found this but I’m not sure how this should be applied with gitea. curl -H "Authorization: token ACCESS_TOKEN" --data '{"name":"NEW_REPO_NAME"}' https://api.github.com/user/repos
The URL you are using is for Github, but if you use the route /api/v1/user/repos and referencing your gitea URL with the same information then a new repo would be created.
Could you please advise for the complete syntax of the command to be executed? curl -H "Authorization: token ACCESS_TOKEN" --data '{"name":"NEW_REPO_NAME"}' https://<my-gitea-url>/api/v1/user/repos
Where can I find the relevant token?
And is tool github cli another option for this use case?
I have created a token in Gitea installation’s web interface and executed this command: curl -k -H "Authorization: token <my-access-token-generated-in-webui>" --data '{"name":"<unique-name>"}' https://<my-gitea-url>/api/v1/user/repos
The output is this: {"message":"Required","url":"https://<my-gitea-url>/api/swagger"}
I have executed the following command and get a new error now:
curl -k -H "content-type: application/json" "Authorization: token <my-access-token-generated-in-webui>" --data '{"name":"<unique-name>"}' https://<my-gitea-url>/api/v1/user/repos
curl: (3) URL using bad/illegal format or missing URL
{"message":"token is required","url":"https://<my-gitea-url/api/swagger"}
After modifying the syntax the repository is created accordingly: curl -k -H "content-type: application/json" -H "Authorization: token <my-access-token-generated-in-webui>" --data '{"name":"<unique-name>"}' https://<my-gitea-url>/api/v1/user/repos
However, the repository is created under the wrong organization, means the organization is the relevant user account. Instead the organization should be etckeeper.
Please check screenshot for details.
How can I create a repository belonging to specific organization etckeeper?
My intention is to have a hierarchy with etckeeper on top an all clients pushing data to its relevant repository identified by FQDN.
I have corrected my syntax and posted this in my reply on Oct. 29 already.
However I want the newly created repository to be created under a specific organization (here: etckeeper).
Please check the screenshots in my previous posting.
In Github, the relevant command would be: curl -H "Authorization: token ACCESS_TOKEN" --data '{"name":"NEW_REPO_NAME"}' https://api.github.com/orgs/ORGANIZATION_NAME/repos
What is the relevant syntax for Gitea?
Or would it make sense to use a specific user account, e.g. etckeeper, instead?
Then I would not need to create a hierarchy with Organization > Repository.