Cannot migrate repo owned by organization with API #11575

Closed
opened 2025-11-02 09:41:31 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @nickmi on GitHub (Aug 31, 2023).

Description

When i try to use the API to migrate a repo from a github organization to gitea, it fails with the following error:

Request:

curl -X POST "http://{{EXTERNAL_IP}}:{{GITEA_PORT}}/api/v1/repos/migrate" \
     -H "Content-Type: application/json" \
     -H "Authorization: token xxx" \
     -d '{
        "clone_addr": "https://github.com/organizationxxx/xxxz.git",
        "auth_token": "xxx",
        "description": "Migrate sample",
        "private": true,
        "repo_name": "xxx",
        "repo_owner": "xxx",
        "mirror": true
     }'

Response:

{
   "message":"Given user is not an organization.",
   "url":"http://localhost:3000/api/swagger"
}

The same operation works fine from the web interface, without the need that the user is an organization.

Gitea Version

1.20.1

How are you running Gitea?

Docker

Database

SQLite

Originally created by @nickmi on GitHub (Aug 31, 2023). ### Description When i try to use the API to migrate a repo from a github organization to gitea, it fails with the following error: Request: ```bash curl -X POST "http://{{EXTERNAL_IP}}:{{GITEA_PORT}}/api/v1/repos/migrate" \ -H "Content-Type: application/json" \ -H "Authorization: token xxx" \ -d '{ "clone_addr": "https://github.com/organizationxxx/xxxz.git", "auth_token": "xxx", "description": "Migrate sample", "private": true, "repo_name": "xxx", "repo_owner": "xxx", "mirror": true }' ``` Response: ```json { "message":"Given user is not an organization.", "url":"http://localhost:3000/api/swagger" } ``` The same operation works fine from the web interface, without the need that the user is an organization. ### Gitea Version 1.20.1 ### How are you running Gitea? Docker ### Database SQLite ###
GiteaMirror added the issue/needs-feedback label 2025-11-02 09:41:31 -06:00
Author
Owner

@lng2020 commented on GitHub (Sep 1, 2023):

I use the same command but it works well. Can you give more specific information about the user and the organization?

@lng2020 commented on GitHub (Sep 1, 2023): I use the same command but it works well. Can you give more specific information about the user and the organization?
Author
Owner

@puni9869 commented on GitHub (Sep 18, 2023):

Please upgrade to the newer version 1.20.4. Might works.

@puni9869 commented on GitHub (Sep 18, 2023): Please upgrade to the newer version 1.20.4. Might works.
Author
Owner

@nickmi commented on GitHub (Sep 21, 2023):

Thank you guys for your response, i cant reproduce the issue anymore. I suspect it had something to do with my access token. I am closing the issue.

@nickmi commented on GitHub (Sep 21, 2023): Thank you guys for your response, i cant reproduce the issue anymore. I suspect it had something to do with my access token. I am closing the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11575