Skip to content

Instantly share code, notes, and snippets.

@zhanglianxin
Created April 15, 2025 13:35
Show Gist options
  • Save zhanglianxin/fa10015f382ebdc6026f9a341374ec54 to your computer and use it in GitHub Desktop.
Save zhanglianxin/fa10015f382ebdc6026f9a341374ec54 to your computer and use it in GitHub Desktop.
migrate your repos from gitlab to gitea
group1,repo1
group2,repo2
#!/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
@zhanglianxin
Copy link
Author

See you never, GitLab!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment