1、下载源代码库
1 2 3 4 5 6 7 8 9
| [root@dax-mysql-slave cbibank]# git clone http://gitlab.cbi.com/dax.fe/bank-www.git 正克隆到 'bank-www'... Username for 'http://gitlab.cbi.com': 123123@qq.com Password for 'http://123123@qq.com@gitlab.cbi.com': remote: Counting objects: 2852, done. remote: Compressing objects: 100% (1237/1237), done. remote: Total 2852 (delta 1596), reused 2747 (delta 1535) 接收对象中: 100% (2852/2852), 125.87 MiB | 459.00 KiB/s, done. 处理 delta 中: 100% (1596/1596), done.
|
2、查看当前gitlab地址
1 2 3
| [root@dax-mysql-slave bank-www]# git remote -v origin http://gitlab.cbi.com/dax.fe/bank-www.git (fetch) origin http://gitlab.cbi.com/dax.fe/bank-www.git (push)
|
3、在目标gitlab新建一个项目,项目地址
https://gitlab.com/zeven0707/bank-www.git
4、下面将源代码库地址替换为目标库地址
1 2 3 4
| [root@dax-mysql-slave bank-www]# git remote set-url origin https://gitlab.com/zeven0707/bank-www.git [root@dax-mysql-slave bank-www]# git remote -v origin https://gitlab.com/zeven0707/bank-www.git (fetch) origin https://gitlab.com/zeven0707/bank-www.git (push)
|
5、查看当前分支
1 2
| [root@dax-mysql-slave bank-www]# git branch * master
|
6、将master分支推送到目标项目
1 2 3 4 5 6 7 8 9 10 11
| [root@dax-mysql-slave bank-www]# git push origin master:master Username for 'https://gitlab.com': 123123@qq.com Password for 'https://123123@qq.com@gitlab.com': Counting objects: 2820, done. Delta compression using up to 8 threads. Compressing objects: 100% (1144/1144), done. Writing objects: 100% (2820/2820), 125.87 MiB | 6.96 MiB/s, done. Total 2820 (delta 1596), reused 2820 (delta 1596) remote: Resolving deltas: 100% (1596/1596), done. To https://gitlab.com/zeven0707/bank-www.git * [new branch] master -> master
|
推送完成,通过gitlab ui查看项目已经推送成功。
6.1、推送分支
git checkout -b develop origin/develop
git push origin develop:develop