Last active
May 12, 2016 08:01
-
-
Save hilen/bea49ea6316f610becc75b030be1241d to your computer and use it in GitHub Desktop.
移动 gitlab 的项目到其他 gitlab 服务器
This file contains 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
#!/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 [email protected]: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