gitlab代码恢复
背景:
从gitlab的web端页面下载了代码。需要恢复到新的gitlab上。下面操作以vonebaas-c-fabric-explorer-front工程为例
已经下载好vonebaas-c-fabric-explorer-front工程的zip包:
操作步骤
原来的git地址是:http://xxx.git.com:9002/
新的git地址是:http://119.45.132.177/
- 在新git上添加一个空的vonebaas-c-fabric-explorer-front工程
- 在git客户端,将新建的vonebaas-c-fabric-explorer-front工程clone下来
比如我的git客户端在一台linux机器上:
root@VM-0-4-ubuntu:~# git clone http://119.45.132.177/baas/vonebaas-c-fabric-explorer-front.git
Cloning into 'vonebaas-c-fabric-explorer-front'...
Username for 'http://119.45.132.177': root
Password for 'http://root@119.45.132.177':
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (3/3), 2.80 KiB | 2.80 MiB/s, done.
- 检查下clone下来的仓库
cd vonebaas-c-fabric-explorer-front
ls -alt
- 将备份的压缩包上传到服务器解压
解压:
unzip vonebaas-c-fabric-explorer-front-master-4092a20d6.zip
- 将数据拷贝到新建的仓库中
cp -rf vonebaas-c-fabric-explorer-front-master-4092a20d6e38d66fc1e8b1cab52409c9613abb03/* vonebaas-c-fabric-explorer-front/
ls vonebaas-c-fabric-explorer-front
- 将新vonebaas-c-fabric-explorer-front提交到新仓库
git add .
git commit -m "add"
git push
- 打开新git,检查恢复情况