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

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

问题描述

我在GitHub中有一个仓库,我需要标记它。我在一个shell中标记,但在GitHub上它没有显示出来。我必须做其他事情吗?



我在shell中使用的命令是:

  git tag 2.0 

现在当我输入 git tag 显示:

  2.0 

所以它好像存在标签,是否正确?

//github.com/keevitaja/myseo-pyrocmsrel =noreferrer> https://github.com/keevitaja/myseo-pyrocms 。



我如何让这个标签出现在GitHub上?我的标签在哪里?

解决方案

您可以使用以下方式为GitHub创建标签:


  • Git命令行,或者

  • GitHub的网络界面。 b $ b

    从命令行创建标签



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

      git标签<标记名> 

    如果您想要在标签中加入描述,请添加 -a 来创建一个带注释的标签

      git标签<标记名> -a 

    这将创建一个本地标记与当前的分支状态。当推送到您的远程回购时,默认不包含标签。您需要明确说明您希望将您的代码推送到您的远程仓库:

      git push origin --tags 

    官方的Linux Kernel Git文档 git push


       - 标记

    在refs / tags下的所有ref都会被推送,除了在命令行中明确列出的refspecs。

    或者if你只是想推一个标签:

      git push origin< tag> 

    另见我对如何使用Git将标签推送到远程存储库?以获取关于上述语法的更多细节。 p>

    通过GitHub的web界面创建标签



    你可以在他们的创建版本帮助页面。以下是一个摘要: 点击我们存储库页面上的发布链接




  • 点击创建新版本制作新版本 src =https://i.stack.imgur.com/MMAgk.pngalt =Screenshot 2>


  • 填写表单字段,然后点击底部的发布发布 $ b



  • 在GitHub上创建标签后,您可能还想将其存储到本地存储库中:

      git fetch 



  • 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?

    The command I used in shell is:

    git tag 2.0
    

    and now when I type git tag it shows:

    2.0  
    

    so it seems like tags are present, correct?

    The repository is: https://github.com/keevitaja/myseo-pyrocms.

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

    解决方案

    You can create tags for GitHub by either using:

    • the Git command line, or
    • GitHub's web interface.

    Creating tags from the command line

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

    git tag <tagname>
    

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

    git tag <tagname> -a
    

    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
    

    From the official Linux Kernel Git documentation for git push:

    --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>
    

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

    Creating tags through GitHub's web interface

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

    1. Click the releases link on our repository page,

    2. Click on Create a new release or Draft a new release,

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

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

      git fetch
      

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

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