Set user avatar with CLI or API #11047

Closed
opened 2025-11-02 09:26:04 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @lonix1 on GitHub (Jun 18, 2023).

Feature Description

We use automation (ansible) to setup multiple servers, each has gitea and our ci/cd stuff. We create the same users each time for our team members.

One can create a user with the CLI: username, password, email, is_admin.

But it's not possible to specify the avatar. It would be nice to do that with the CLI (or some other method, maybe just put the images in a certain directory using a certain filename?).

Screenshots

No response

Originally created by @lonix1 on GitHub (Jun 18, 2023). ### Feature Description We use automation (ansible) to setup multiple servers, each has gitea and our ci/cd stuff. We create the same users each time for our team members. One can create a user with the CLI: username, password, email, is_admin. But it's not possible to specify the avatar. It would be nice to do that with the CLI (or some other method, maybe just put the images in a certain directory using a certain filename?). ### Screenshots _No response_
GiteaMirror added the type/proposaltype/feature labels 2025-11-02 09:26:04 -06:00
Author
Owner

@lonix1 commented on GitHub (Jun 18, 2023):

On second thought, I think this could be too complex with the cli.

Maybe instead just copy the image into the avatars directory and let gitea find it - is that possible? I guess the The filename must be hashed somehow so gitea knows about it?

If out of scope, please close this issue.

@lonix1 commented on GitHub (Jun 18, 2023): On second thought, I think this could be too complex with the cli. Maybe instead just copy the image into the avatars directory and let gitea find it - is that possible? I guess the The filename must be hashed somehow so gitea knows about it? If out of scope, please close this issue.
Author
Owner

@silverwind commented on GitHub (Jun 18, 2023):

I guess it could be added, but 5 arguments on a CLI is already pushing the complexity. It may already be possible via API to set the avatar, and your use case does sound like it may be better done with an API client.

@silverwind commented on GitHub (Jun 18, 2023): I guess it could be added, but 5 arguments on a CLI is already pushing the complexity. It may already be possible via API to set the avatar, and your use case does sound like it may be better done with an API client.
Author
Owner

@lonix1 commented on GitHub (Jun 18, 2023):

I didn't know there was an API... Thanks for letting me know!

I will tinker with this and report back my solution.

@lonix1 commented on GitHub (Jun 18, 2023): I didn't know there was [an API](https://docs.gitea.com/development/api-usage)... Thanks for letting me know! I will tinker with this and report back my solution.
Author
Owner

@lonix1 commented on GitHub (Jun 18, 2023):

UPDATE:

I checked on https://try.gitea.io/api/swagger, but unfortunately there is no endpoint for avatars. 😞

@lonix1 commented on GitHub (Jun 18, 2023): UPDATE: I checked on `https://try.gitea.io/api/swagger`, but unfortunately there is no endpoint for avatars. :disappointed:
Author
Owner

@silverwind commented on GitHub (Jun 18, 2023):

Yeah, it seems we are lacking both a POST /user and a PATCH /user.

@silverwind commented on GitHub (Jun 18, 2023): Yeah, it seems we are lacking both a `POST /user` and a `PATCH /user`.
Author
Owner

@JakobDev commented on GitHub (Jun 19, 2023):

I will start working on this

@JakobDev commented on GitHub (Jun 19, 2023): I will start working on this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11047