gitlab项目完整迁移(含所有分支&提交记录&标签)

61 阅读1分钟
  • clone原项目fe-pro
    git clone 原git地址(https://gitlab.***.com/old/**/fe-pro.git )
    
    
  • 进入项目fe-pro根目录
    cd fe-pro
    
    
  • 执行git命令
    git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"done
    
    git fetch --all --prune --tags
    
    git pull --all
    
    
    
  • 设置新git远端地址
    git remote set-url origin 新git地址(https://github.***.com/new/**/fe-pro.git )
    
    
  • 推至远端
    git push origin --tags && git push origin --all
    
    #强制push
    git push -f origin --tags && git push -f origin --all