Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitea - create repo API

Tags:

gitea

trying to create repository via API. using swagger execute mode:

curl -X POST "https://URL/git/api/v1/user/repos?access_token=XXXXX" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"auto_init\": true, \"description\": \"blablabla\", \"gitignores\": \"string\", \"issue_labels\": \"string\", \"license\": \"string\", \"name\": \"blablabla\", \"private\": true, \"readme\": \"string\"}"

yields 500 error, complains about readme.

{"message":"initRepository: prepareRepoCommit: getRepoInitFile[string]: open /readme/string: file does not exist","url":"URLr"}

Guess because of this param:

"readme\": \"string\"

I don’t know what’s the suggested value for that but it’s in swagger docs.
any ideas ?

like image 703
Vano Avatar asked May 17 '26 09:05

Vano


1 Answers

The default json body params supplied by swagger are not working.

This did the trick:

{
  "auto_init": true,
  "description": "blablabla",
  "gitignores": "",   <--- empty string instead of defaults
  "issue_labels": "", <--- empty string instead of defaults
  "license": "",      <--- empty string instead of defaults
  "name": "ccc2",
  "private": true,
  "readme": ""        <--- empty string instead of defaults
} 
like image 100
Vano Avatar answered May 24 '26 04:05

Vano



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!