Skip to content

Instantly share code, notes, and snippets.

@hilen
Last active May 12, 2016 08: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 hilen/bea49ea6316f610becc75b030be1241d to your computer and use it in GitHub Desktop.
Save hilen/bea49ea6316f610becc75b030be1241d to your computer and use it in GitHub Desktop.
移动 gitlab 的项目到其他 gitlab 服务器
#!/bin/sh
repo=$1
# token="yPgnGZ1PsQ123123REsvjdmTnT" #http://gitlab.mogujie.org/profile/account 找 private token
# test -z $repo && echo "Repo name required." 1>&2 && exit 1
# #获取 namespace_id: curl http://gitlab.mogujie.org/api/v3/namespaces?private_token=yPgnGZ1P123123sQREsvjdmTnT
# curl -H "Content-Type:application/json" http://gitlab.mogujie.org/api/v3/namespaces?private_token=$token -d "{ \"name\": \"$repo\", \"public\":\"true\", \"namespace\":{ \"id\": \"1448\",\"path\":\"$repo\"}}"
git clone git@gitlab.fexot.meiliworks.com:iOS/$repo.git
cd $repo
# fetch all the branches
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
git remote set-url origin http://gitlab.mogujie.org/meilishuo-ios-archives/$repo.git
git push --all origin
git push origin --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment