Howto create repository using api

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"}'

Please advise.


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.

1 Like

thanks for your reply.

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?

1 Like

I don’t think the github cli will work. The documentation page will provide you with the information you need regarding the token.

Why don’t you think that github cli will work?
Is this tool restricted to usage with GitHub?

Yes, I don’t think it is suited to deal with the small differences between the GitHub and Gitea API.

There is a specific Gitea CLI gitea/tea: A command line tool to interact with Gitea servers - tea - Gitea: Git with a cup of tea

1 Like

Many thanks for sharing this information.

1 Like

Thanks for such information.