上传本地工程到gitlab

进入本地工程目录

Jimmy@DESKTOP-EEU0RI1 MINGW64 /d/personal/项目/新唐MCU/projectMaster/MS51FB9AE (master)
$ ll
total 0
drwxr-xr-x 1 Jimmy 197121 0  918  2019 Document/
drwxr-xr-x 1 Jimmy 197121 0  918  2019 Library/
drwxr-xr-x 1 Jimmy 197121 0  918  2019 Sample_Code/

建立本地Git仓库

(1)git init
(2)git add .
(3)git commit -m "initial code"

关联远程gitlab仓库

git remote add origin http://10.10.2.1:8082/insight/MS51FB9AE.git

MS51FB9AE是你即将要创建的远程仓库名,用下面的命令可以查看是否关联成功

$ git config -l
...
remote.origin.url=http://10.10.2.1:8082/insight/MS51FB9AE.git
...

建立并推送远程gitlab仓库

$ git push -u git@10.10.2.1:insight/MS51FB9AE.git
Enumerating objects: 269, done.
Counting objects: 100% (269/269), done.
Delta compression using up to 8 threads
Compressing objects: 100% (221/221), done.
Writing objects: 100% (269/269), 1.62 MiB | 12.76 MiB/s, done.
Total 269 (delta 104), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (104/104), done.
remote:
remote:
remote: The private project insight/MS51FB9AE was successfully created.
remote:
remote: To configure the remote, run:
remote:   git remote add origin git@10.10.2.1:insight/MS51FB9AE.git
remote:
remote: To view the project, visit:
remote:   http://10.10.2.1:8082/insight/MS51FB9AE
remote:
remote:
To 10.10.2.1:insight/MS51FB9AE.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'git@10.10.2.1:insight/MS51FB9AE.git'.

这样子就成功在gitlab上的insight group里面创建了MS51FB9AE这个仓库,上传的是master这个主分支,如果想上传其它分支,可以加上分支名

$ git push -u git@10.10.2.1:insight/MS51FB9AE.git modbusRTU:modbusRTU
Enumerating objects: 38, done.
Counting objects: 100% (38/38), done.
Delta compression using up to 8 threads
Compressing objects: 100% (33/33), done.
Writing objects: 100% (34/34), 207.88 KiB | 6.50 MiB/s, done.
Total 34 (delta 4), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for modbusRTU, visit:
remote:   http://10.10.2.1:8082/insight/MS51FB9AE/merge_requests/new?merge_request%5Bsource_branch%5D=modbusRTU
remote:
To 10.10.2.1:insight/MS51FB9AE.git
 * [new branch]      modbusRTU -> modbusRTU
Branch 'modbusRTU' set up to track remote branch 'modbusRTU' from 'git@10.10.2.1:insight/MS51FB9AE.git'.

其中,modbusRTU:modbusRTU —— 本地分支名:远程分支名

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值