Created
April 15, 2025 13:35
-
-
Save zhanglianxin/fa10015f382ebdc6026f9a341374ec54 to your computer and use it in GitHub Desktop.
migrate your repos from gitlab to gitea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group1,repo1 | |
group2,repo2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ACCESS_TOKEN="YOUR_GITEA_ACCESS_TOKEN" | |
URL="https://YOUR_GITEA_SITE/api/v1/repos/migrate?access_token=$ACCESS_TOKEN" | |
GITLAB_ACCESS_TOKEN="YOUR_GITLAB_ACCESS_TOKEN" | |
grep -v '^$' "input.txt" | while IFS=',' read -r owner name | |
do | |
json='{ | |
"auth_token": "'$GITLAB_ACCESS_TOKEN'", | |
"clone_addr": "https://gitlab.com/'$owner'/'$name'", | |
"issues": true, | |
"labels": true, | |
"lfs": true, | |
"milestones": true, | |
"private": true, | |
"pull_requests": true, | |
"releases": true, | |
"repo_name": "'$name'", | |
"repo_owner": "'$owner'", | |
"service": "gitlab", | |
"wiki": true | |
}' | |
# curl -X DELETE \ | |
# "https://YOUR_GITEA_SITE/api/v1/repos/$owner/$name?access_token=$ACCESS_TOKEN" \ | |
# -H 'accept: application/json' | |
curl -X POST \ | |
-H 'accept: application/json' \ | |
-H "Content-Type: application/json" \ | |
-d "$json" \ | |
"$URL" | |
# echo "$json" | |
echo -e "Sent data for $name\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See you never, GitLab!