Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] API endpint for repo transfer #9858

Closed
6543 opened this issue Jan 18, 2020 · 3 comments · Fixed by #9947
Closed

[Feature] API endpint for repo transfer #9858

6543 opened this issue Jan 18, 2020 · 3 comments · Fixed by #9947
Labels
modifies/api This PR adds API routes or modifies them

Comments

@6543
Copy link
Member

6543 commented Jan 18, 2020

expose repo-transfer function from UI to API

@camlafit
Copy link
Contributor

Could be in /repos/{owner}/{repo} API options adding new_owner option

@lunny lunny added the modifies/api This PR adds API routes or modifies them label Jan 19, 2020
@camlafit
Copy link
Contributor

Hello

As workardound we can do this :

GITEA_HOST="try.gitea.io"
GITEA_PORT="443"
#Account to webui
user=""
password=""
old_owner=""
new_owner=""
repo_name=""

#GET cookies data (and csrf data)
curl -X GET \
    -c cookies.txt \
    -s \
    -d "redirect_to=/$old_owner/$repo_name/settings" \
    "$GITEA_HOST:$GITEA_PORT/user/login" \
    > /dev/null

csrf=$(grep csrf cookies.txt|sed 's/.*csrf\s*\(.*\)/\1/')

#Connect as admin
curl -X POST \
    -b cookies.txt \
    -c cookies.txt \
    -s \
    -d "user_name=$user&password=$password&_csrf=$csrf&redirect_to=/$old_owner/$repo_name/settings" \
    "$GITEA_HOST:$GITEA_PORT/user/login" \
    > /dev/null

    echo "Transfer $repo_name"
    curl -X GET \
        -b cookies.txt \
        -c cookies.txt \
        -s \
        "$GITEA_HOST:$GITEA_PORT/$old_owner/$repo_name/settings" \
        > /dev/null

    csrf=$(grep csrf cookies.txt|sed 's/.*csrf\s*\(.*\)/\1/')

    #Move plugin to its new orga
    curl -X POST \
        -b cookies.txt \
        -c cookies.txt \
        -d "repo_name=$repo_name&new_owner_name=$new_owner&_csrf=$csrf&action=transfer" \
        "$GITEA_HOST:$GITEA_PORT/$old_owner/$repo_name/settings"

@6543
Copy link
Member Author

6543 commented Jan 23, 2020

github as a own endpoint for this: POST /repos/:owner/:repo/transfer

link spec

open PR witch can be cherry-picked & modivied: https://gitea.artixlinux.org/artix/gitea/pulls/1/files

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants