
两种方式, 如果多就迁移,如果少,就新建。



选择 【下载导出】





核心
#从老gitlib拉取裸仓库,并在本地文件系统创建gitbook-demo.git文件夹
git clone --bare ssh://git@oldgitlab:port/group1/gitproject-demo.git
#进入代码目录
cd gitproject-demo.git
#向新git推送镜像
git push --mirror ssh://git@newgitlab:port/group1/gitproject-demo.git--bare是裸仓库的意思,区别与git clone,他不是一个工作空间,不可以在目录下进行变更操作,即使操作了也不被接受, 执行命令后会复制全部的分支、标签,并且在命令执行过程中的所有远端的变动均被忽略。–bare Make a bare Git repository. That is, instead of creating
<directory>and placing the administrative files in<directory>/.git, make the<directory>itself the $GIT_DIR. This obviously implies the --no-checkout because there is nowhere to check out the working tree. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them torefs/remotes/origin/. When this option is used, neither remote-tracking branches nor the related configuration variables are created.
--mirror镜像代码仓库,完完整整Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration option remote..mirror is set.
ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge
$ git clone --bare http://ip:port/xxxx/yyy.git
Cloning into bare repository 'uomSM.git'...
remote: Enumerating objects: 1438, done.
remote: Total 1438 (delta 0), reused 0 (delta 0), pack-reused 1438
Receiving objects: 100% (1438/1438), 872.14 MiB | 32.58 MiB/s, done.
Resolving deltas: 100% (420/420), done.
ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge

按需选择

```java
ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge
$ pwd
/d/codeMerge
ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge
$ cd uomSM.git/
- uom子群组名
- yyy自定义项目名称,我一般保持和旧的项目一致
$ git push --mirror https://新git地址/xxxx/uom/yyy.git
OK,分支正常,提交日志正常。






记住该令牌
git clone https://xxxx/xx/xxx/xxxxx.git
输入 账号和个人访问令牌

执行 git config --global http.sslverify false
请按照 《设置个人访问令牌》章节设置密码,并保存该密码,使用该密码访问Gitlab