Creating org and repo during bootstrap #9400

Closed
opened 2025-11-02 08:37:36 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @prajith-nair on GitHub (Aug 15, 2022).

Feature Description

It would be good to have a feature to allow creation of default repo and organisation during bootstrapping process. Currently, we have a flag DEFAULT_ALLOW_CREATE_ORGANIZATION which allows new users to create organizations by default. There is a scenario were all non-admin users should be part of single org and single repo during bootstrap. The flag can be enabled at admin level to allow users to be added to an org and repo by default, that way avoiding each non-admin user to create new org.

Screenshots

No response

Originally created by @prajith-nair on GitHub (Aug 15, 2022). ### Feature Description It would be good to have a feature to allow creation of default repo and organisation during bootstrapping process. Currently, we have a flag `DEFAULT_ALLOW_CREATE_ORGANIZATION` which allows new users to create organizations by default. There is a scenario were all non-admin users should be part of single org and single repo during bootstrap. The flag can be enabled at admin level to allow users to be added to an org and repo by default, that way avoiding each non-admin user to create new org. ### Screenshots _No response_
GiteaMirror added the type/proposaltype/feature labels 2025-11-02 08:37:36 -06:00
Author
Owner

@prajith-nair commented on GitHub (Aug 15, 2022):

I can use API call to create an org however, the challenge is "GITEA_ADMIN_USER" is created before org and hence we endup getting "user already exists [name: xx-xxx]"

curl --request POST --url http://$HOSTNAME:$GITEA_PORT/api/v1/orgs -H "accept: application/json" -H "content-type: application/json"  -d '{
  "description": "",
  "full_name": "'"$CUSTOMER_ID"'",
  "location": "",
  "repo_admin_change_team_access": true,
  "username": "'"$GITEA_ADMIN_USER"'",
  "visibility": "private",
  "website": ""
}'  -H "Authorization: token xxxxxxx"

{"message":"user already exists [name: xx-xxx]","url":"https://xx.xx.com:xxx/nsgapps/api/swagger"}

@prajith-nair commented on GitHub (Aug 15, 2022): I can use API call to create an org however, the challenge is "GITEA_ADMIN_USER" is created before org and hence we endup getting "user already exists [name: xx-xxx]" ``` curl --request POST --url http://$HOSTNAME:$GITEA_PORT/api/v1/orgs -H "accept: application/json" -H "content-type: application/json" -d '{ "description": "", "full_name": "'"$CUSTOMER_ID"'", "location": "", "repo_admin_change_team_access": true, "username": "'"$GITEA_ADMIN_USER"'", "visibility": "private", "website": "" }' -H "Authorization: token xxxxxxx" ``` ```{"message":"user already exists [name: xx-xxx]","url":"https://xx.xx.com:xxx/nsgapps/api/swagger"}```
Author
Owner

@prajith-nair commented on GitHub (Aug 15, 2022):

Apparently, username in the payload is misleading. It has to be ORG name instead of username
I got it working using below API call

curl --request POST --url http://$GITEA_ADMIN_USER:$GITEA_ADMIN_PASSWORD@$HOSTNAME:$GITEA_PORT/api/v1/orgs -H "accept: application/json" -H "content-type: application/json" -d '{ "description": "", "full_name": "'"$CUSTOMER_ID"'", "location": "", "repo_admin_change_team_access": true, "username": "'"$CUSTOMER_ID"'", "visibility": "private", "website": "" }'

We need to create a PR to change the payload to look something like below.... Its confusing for the reader if we use "username" as parameter.
{
"description": "string",
"full_name": "string",
"location": "string",
"repo_admin_change_team_access": true,
"orgname": "string",
"visibility": "public",
"website": "string"
}

@prajith-nair commented on GitHub (Aug 15, 2022): Apparently, `username` in the payload is misleading. It has to be **ORG** name instead of **username** I got it working using below API call `curl --request POST --url http://$GITEA_ADMIN_USER:$GITEA_ADMIN_PASSWORD@$HOSTNAME:$GITEA_PORT/api/v1/orgs -H "accept: application/json" -H "content-type: application/json" -d '{ "description": "", "full_name": "'"$CUSTOMER_ID"'", "location": "", "repo_admin_change_team_access": true, "username": "'"$CUSTOMER_ID"'", "visibility": "private", "website": "" }' ` We need to create a PR to change the payload to look something like below.... Its confusing for the reader if we use "username" as parameter. { "description": "string", "full_name": "string", "location": "string", "repo_admin_change_team_access": true, "**orgname**": "string", "visibility": "public", "website": "string" }
Author
Owner

@lunny commented on GitHub (Aug 16, 2022):

You can use commandline to do that.

@lunny commented on GitHub (Aug 16, 2022): You can use commandline to do that.
Author
Owner

@prajith-nair commented on GitHub (Sep 26, 2022):

Thanks, we have got it working.

@prajith-nair commented on GitHub (Sep 26, 2022): Thanks, we have got it working.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9400