GitLab创建tag并进行推送

本文档介绍了在GitLab中创建和推送tag的完整流程,包括变更文件、本地创建tag、列出tag、提交代码到本地仓库、将tag推送到远程服务器以及更新远程仓库的最新代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

GitLab创建tag并进行推送

变更文件

[root@node01 testq]# vim test.yaml

本地创建tag

git tag v1.1

列出tag

[root@node01 testq]# git tag

v1.0
v1.1

创建修改,git add .或者git add 文件名, 注意 “.” 代表提交全部更改到本地仓库,也可以将.改为指定的文件名。

[root@node01 testq]# git add .

git commit -m “更改注释”,使用git commit -m "注释"提交代码到本地仓库。

[root@node01 testq]# git commit -m “add test.yaml2”

[main 6ac984c] add test.yaml2
Committer: zhenyu <root@node01.dhccloud.com.cn>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+), 1 deletion(-)

将新建的tag推送到远程服务器。

[root@node01 testq]# git push origin v1.1

Username for 'http://gitlab.example.com': zhenyu
Password for 'http://zhenyu@gitlab.example.com':
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 295 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To http://gitlab.example.com/root/testq.git
 * [new tag]         v1.1 -> v1.1

更新现有仓库,上面只完成了推送新建标签的任务,我们还得把最新版本的代码推送发到远程仓库,使用git pull先拉取一下代码。

[root@node01 testq]# git pull

Already up-to-date.

推送代码,使用git push将最新的代码推送到远程仓库,至此,我们成功将最新代码推送到远程仓库并打上了tag。

[root@node01 testq]# git push

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Username for 'http://gitlab.example.com': zhenyu
Password for 'http://zhenyu@gitlab.example.com':
Total 0 (delta 0), reused 0 (delta 0)
To http://gitlab.example.com/root/testq.git
   4d8f9d1..6ac984c  main -> main
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值