在GitHub存储库中创建标签 [英] Create a tag in a GitHub repository

查看:80
本文介绍了在GitHub存储库中创建标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitHub中有一个存储库,我需要对其进行标记.
我在外壳中加了标签,但在 GitHub 上却没有显示.

I have a repository in GitHub and I need to tag it.
I tagged in a shell, but on GitHub, it is not showing up.

我还必须做其他事情吗?

Do I have to do anything else?

我在shell中使用的命令是:

The command I used in the shell is:

git tag 2.0

现在,当我键入git tag时,它将显示:

And now when I type git tag it shows:

2.0

看来标签存在,对吗?

存储库为: https://github.com/keevitaja/myseo-pyrocms .

如何使此标签显示在GitHub上?我的标签在哪里?

How do I make this tag show up on GitHub? Where are my tags?

推荐答案

您可以使用以下任一方法为GitHub创建标签:

You can create tags for GitHub by either using:

  • Git命令行,或
  • GitHub的Web界面.

要在当前分支上创建标签,请运行以下命令:

To create a tag on your current branch, run this:

git tag <tagname>

如果要在标签中包含说明,请添加-a以创建

If you want to include a description with your tag, add -a to create an annotated tag:

git tag <tagname> -a

这将使用您所在分支的当前状态创建一个local标记.推送到远程仓库时,默认情况下不包括标签.您需要明确表示要将标签推送到远程仓库:

This will create a local tag with the current state of the branch you are on. When pushing to your remote repo, tags are NOT included by default. You will need to explicitly say that you want to push your tags to your remote repo:

git push origin --tags

来自 Linux Kernel Git官方文档> :

--tags

除了在命令行上明确列出的参考规范外,所有参考/标签下的参考都被推送.

All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line.

或者,如果您只想推送单个标签:

Or if you just want to push a single tag:

git push origin <tag>

另请参阅我对的回答您是否使用Git将标签推送到远程存储库?,以获取有关上述语法的更多详细信息.

See also my answer to How do you push a tag to a remote repository using Git? for more details about that syntax above.

您可以在其创建发布帮助页面中找到GitHub的说明.这是一个摘要:

You can find GitHub's instructions for this at their Creating Releases help page. Here is a summary:

  1. 点击我们存储库页面上的版本链接

点击创建新版本起草新版本

填写表单字段,然后单击底部的发布版本

Fill out the form fields, then click Publish release at the bottom,

在GitHub上创建标签后,您可能还希望将其提取到本地存储库中:

After you create your tag on GitHub, you might want to fetch it into your local repository too:

git fetch

现在,下次您可能要在网站的同一发行版中再创建一个标签.为此,请按照以下步骤操作:

Now next time, you may want to create one more tag within the same release from website. For that follow these steps:

转到发布"标签

  1. 单击发布的编辑按钮

  1. Click on edit button for the release

提供新标签ABC_DEF_V_5_3_T_2的名称,然后点击选项卡

Provide name of the new tag ABC_DEF_V_5_3_T_2 and hit tab

点击选项卡后,UI将显示以下消息:太好了!发布此版本时,将从目标创建此标记. UI还将提供一个选择分支/提交的选项

After hitting tab, UI will show this message: Excellent! This tag will be created from the target when you publish this release. Also UI will provide an option to select the branch/commit

选择分支或提交

选中qa标签的这是预发行版"复选框,如果为Prod标签创建了标签,则取消选中它.

Check "This is a pre-release" checkbox for qa tag and uncheck it if the tag is created for Prod tag.

之后,单击更新版本"

After that click on "Update Release"

这将在现有版本中创建一个新标签.

This will create a new Tag within the existing Release.

这篇关于在GitHub存储库中创建标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆