[Bug] [API] repoCreateFile return 500 if branch not exist #5195

Closed
opened 2025-11-02 06:17:26 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @6543 on GitHub (Apr 6, 2020).

as title

try: curl -X POST "https://try.gitea.io/api/v1/repos/abcKing/repo_uninit/contents/README.md?token=yourtocken" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"author\": { \"email\": \"user@example.com\", \"name\": \"string\" }, \"branch\": \"string\", \"committer\": { \"email\": \"user@example.com\", \"name\": \"string\" }, \"content\": \"c3RyaW5nCg==\", \"dates\": { \"author\": \"2020-04-06T01:37:35.137Z\", \"committer\": \"2020-04-06T01:37:35.137Z\" }, \"message\": \"string\"}"

It return:

{
  "message": "branch does not exist [name: string]",
  "url": "https://try.gitea.io/api/swagger"
}

Gitea Version: 1.12.0+dev-89-gb264c3039

Originally created by @6543 on GitHub (Apr 6, 2020). as title try: `curl -X POST "https://try.gitea.io/api/v1/repos/abcKing/repo_uninit/contents/README.md?token=yourtocken" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"author\": { \"email\": \"user@example.com\", \"name\": \"string\" }, \"branch\": \"string\", \"committer\": { \"email\": \"user@example.com\", \"name\": \"string\" }, \"content\": \"c3RyaW5nCg==\", \"dates\": { \"author\": \"2020-04-06T01:37:35.137Z\", \"committer\": \"2020-04-06T01:37:35.137Z\" }, \"message\": \"string\"}"` It return: ``` { "message": "branch does not exist [name: string]", "url": "https://try.gitea.io/api/swagger" } ``` Gitea Version: 1.12.0+dev-89-gb264c3039
GiteaMirror added the type/bug label 2025-11-02 06:17:26 -06:00
Author
Owner

@6543 commented on GitHub (Apr 6, 2020):

Expecting 404 or 422

@6543 commented on GitHub (Apr 6, 2020): Expecting 404 or **422**
Author
Owner

@stale[bot] commented on GitHub (Jun 5, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Jun 5, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@6543 commented on GitHub (Jun 7, 2020):

tested - still exist

@6543 commented on GitHub (Jun 7, 2020): tested - still exist
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5195