API: unable to post a first file to the empty repository #6842

Closed
opened 2025-11-02 07:08:16 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @d-lunyov on GitHub (Feb 10, 2021).

Repository was created with an API call createCurrentUserRepo and parameter "auto_init" set to false.

After that I want to create a first commit with README.md file, with the repoCreateFile request:
POST http://localhost:3000/api/v1/repos/lunik/apiRepoTest1/contents/README.md
with the next body:
{ "content":"aGVsbG8==", "message": "initial" }

I've got the next response (also this is illegal JSON):

{"message":"repo is empty","url":"http://localhost:3000/api/swagger"}
{"message":"illegal base64 data at input byte 8","url":"http://localhost:3000/api/swagger"}

Originally created by @d-lunyov on GitHub (Feb 10, 2021). Repository was created with an API call [createCurrentUserRepo](http://localhost:3000/api/swagger#/repository/createCurrentUserRepo) and parameter "auto_init" set to false. After that I want to create a first commit with README.md file, with the [repoCreateFile](http://localhost:3000/api/swagger#/repository/repoCreateFile) request: `POST http://localhost:3000/api/v1/repos/lunik/apiRepoTest1/contents/README.md` with the next body: `{ "content":"aGVsbG8==", "message": "initial" }` I've got the next response (also this is illegal JSON): > {"message":"repo is empty","url":"http://localhost:3000/api/swagger"} > {"message":"illegal base64 data at input byte 8","url":"http://localhost:3000/api/swagger"}
GiteaMirror added the modifies/api label 2025-11-02 07:08:17 -06:00
Author
Owner

@delvh commented on GitHub (Feb 12, 2021):

This is somewhat related to #6918, I'd say: The ability to create files on an empty repository (using the web interface).
There however, the API most likely did not get updated as well to allow for that. I'll ask there whether a) it has already been fixed b) that branch is the correct branch for that or whether c) a new branch should be opened for this.

@delvh commented on GitHub (Feb 12, 2021): This is somewhat related to #6918, I'd say: The ability to create files on an empty repository (using the web interface). There however, the API most likely did not get updated as well to allow for that. I'll ask there whether a) it has already been fixed b) that branch is the correct branch for that or whether c) a new branch should be opened for this.
Author
Owner

@delvh commented on GitHub (Feb 13, 2021):

Okay, as it seems, this issue will be blocked until #6918 has been merged.
Afterwards, it should be simple to fix.

@delvh commented on GitHub (Feb 13, 2021): Okay, as it seems, this issue will be blocked until #6918 has been merged. Afterwards, it should be simple to fix.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6842