Skip to content

Instantly share code, notes, and snippets.

@Crosse
Last active June 27, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Crosse/70e6a49801c70d32927ab20aab61e894 to your computer and use it in GitHub Desktop.
Save Crosse/70e6a49801c70d32927ab20aab61e894 to your computer and use it in GitHub Desktop.
#!/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