Last active
June 27, 2020 21:01
-
-
Save Crosse/70e6a49801c70d32927ab20aab61e894 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -euf -o pipefail | |
repo="$1" | |
gitea_server=your.server.here | |
apiToken="gitea_api_token" | |
uid="gitea_uid" | |
url="https://$server/api/v1/repos/migrate?access_token=$apiToken" | |
#githubUser=username | |
#githubPass="one-time-password" | |
#githubCloneAddr="https://github.com/$githubUser/${repo}.git" | |
bitbucketUser=username | |
bitbucketPass="password" | |
bitbucketCloneAddr="https://bitbucket.org/$bitbucketUser/${repo}.git" | |
user=$bitbucketUser | |
pass=$bitbucketPass | |
cloneAddr=$bitbucketCloneAddr | |
payload=" | |
{ | |
\"clone_addr\": \"$cloneAddr\", | |
\"repo_name\": \"$repo\", | |
\"uid\": $uid, | |
\"mirror\": true, | |
\"private\": true, | |
\"auth_username\": \"$user\", | |
\"auth_password\": \"$pass\" | |
}" | |
curl -Ss -XPOST "$url" -H "accept: application/json" -H "Content-Type: application/json" -d "$payload" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment