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