本地项目提交GitLab

本文详细介绍了如何在GitLab上创建新项目,包括初始化本地仓库、添加远程仓库、提交并推送代码的基本步骤。
摘要由CSDN通过智能技术生成
按步骤来

1. 1 先在gitlab上创建空白项目

按需选择,一般新建一个空白即可

1. 2 填写项目信息

填写完成后点击创建

2.1 给本地项目初始化git

小技巧:直接在项目地址处键入cmd,然后回车可以直接打开Terminal。

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git init

输入git init,创建git仓库,如下:

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git init
Initialized empty Git repository in F:/project/Demo/.git/

F:\project\Demo>

这样我们就完成了git仓库创建,

输入git status,出现如下提示说明创建成功

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git init
Initialized empty Git repository in F:/project/Demo/.git/

F:\project\Demo>git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .hbuilderx/
        App.vue
        common/
        components/
        index.html
        main.js
        manifest.json
        pages.json
        pages/
        static/
        store/
        uni.promisify.adaptor.js
        uni.scss
        uni_modules/
        unpackage/

nothing added to commit but untracked files present (use "git add" to track)

F:\project\Demo>

回到刚刚在GitLab创建好得项目界面

把项目url复制下来,输入git remote add origin 后面加上复制得url

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git remote add origin https://gitlab.com/xx/demo.git

回车,

然后输入git remote get-url origin 测试是否添加成功

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git remote get-url origin
https://gitlab.com/xx/demo.git

F:\project\Demo>

如果出现刚配置的地址则表示成功!

2.2 提交项目

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git add.

键入git add .  

期中.代表全部文件

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git commit -m'这里是日志'

然后键入git commit -m ‘’      commit一下,期中日志信息是必须填写的!!!!

Microsoft Windows [版本 10.0.18363.778]
(c) 2019 Microsoft Corporation。保留所有权利。

F:\project\Demo>git push -u origin master

最后一步将代码push,然后再gitlab上可以找到刚提交的代码了

大功告成

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值