Skip to content

Instantly share code, notes, and snippets.

@shurph
Created August 1, 2013 11:04
Show Gist options
  • Save shurph/6130411 to your computer and use it in GitHub Desktop.
Save shurph/6130411 to your computer and use it in GitHub Desktop.
Перенос репозитория с github на bitbucket со всеми удаленными ветками.
#!/bin/bash
# Copy repo from github to bitbucket
# before run this script you should do:
# 1.
# git clone git@github.com:username/reponame.git
# 2.
# cd reponame
# 3. create new repo on bitbucket
# 4.
# git remote add bitbucket ssh://git@bitbucket.org/username2/reponame.git
# ---------
for i in `git branch -r`
do
remote=`echo $i | cut -b -7`
branch=`echo $i | cut -b 8-`
if [ "$remote" == "origin/" ]
then
git checkout $branch
git push bitbucket +$branch
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment