适用于单个仓库进行迁移.
# 填写项目名, 旧仓库地址, 新仓库地址
Name_Project="temp-oldRepo"
OLD_REMOTE_REPO="git@gitee.com:jrri/$Name_Project.git"
NEW_REMOTE_REPO="git@gitee.com:jrri/temp-newRepo.git"
# 克隆旧仓库
git clone $OLD_REMOTE_REPO $Name_Project
## 获取所有分支
cd $Name_Project
git branch -r
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
# 修改远程绑定
git remote set-url origin $NEW_REMOTE_REPO
# 推送新仓库
git push --all origin