首页 > 其他 > 详细

Gitlab项目迁移

时间:2019-02-28 11:51:56      阅读:283      评论:0      收藏:0      [点我收藏+]
  • 开发的时候通常会有个基础版的项目代码,新开项目时可以以基础版进行开发。 然而在gitlab上不能直接以基础版的仓库来新建项目,所以需要我们通过命令行方式进行操作。  

  1.下载原有gitlab源码


     git clone http://gitlab.**.com/projectName


    2. gitlab地址替换成为新gitlab地址


     git remote set-url origin http://gitlab.**.com/newProjectName


     3.本地推送到远程-可以在sourceTree中进行推送


     git push origin --all 推送主干和分支
     git push --tags 推送标签


     4.查看远程gitlab地址


     git remote -v


     5.master版本回退


     将master分支移除protected分支
     git reset --hard 版本号 或者 sourceTree选择’将master重置到本次提交’,选择‘强行合并’
     git push -u origin master -f

  还可以通过镜像的方式迁移

     1.克隆老项目的镜像


     git clone --mirror old.git (old.git 为老项目的git地址)


     2.进入项目目录


     cd old.git


     3.老项目的地址替换成新项目


     git remote set-url --push origin new.git (new.git 为新项目的git地址)


     4.将镜像推到远程

  git push origin --all 推送主干和分支
     git push --tags 推送标签

Gitlab项目迁移

原文:https://www.cnblogs.com/zhouyun-yx/p/10448999.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!