Create a tag in GitHub repository

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:

  • Click the releases link on our repository page,

    屏幕截图1

  • Click on Create a new release or Draft a new release ,

    截图2

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

    屏幕截图3

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

    git fetch
    

  • You just have to push the tag after you run the git tag 2.0 command.

    So just do git push --tags now.


    Creating Tags

    Git uses two main types of tags: lightweight and annotated .

    Annotated Tags : To create annotated tag in git you can just run following simple commands on your terminal.

    $ git tag -a v2.1.0 -m "xyz feature is released in this tag."
    $ git tag
    v1.0.0
    v2.0.0
    v2.1.0
    

    The -m denotes message for that particular tag. We can write summary of features which is going to tag here.

    Lightweight Tags :

    The other way to tag commits is lightweight tag. we can do it in the following way:

    $ git tag v2.1.0
    $ git tag
    v1.0.0
    v2.0.0
    v2.1.0
    

    Push Tag

    To push particular tag you can use below command:

    git push origin v1.0.3
    

    or if you want to push all tags then use below command:

    git push --tags
    

    List all tags : To list all tags use following command

    git tag
    
    链接地址: http://www.djcxy.com/p/27130.html

    上一篇: 如何使用refspec将Git标签推送到分支?

    下一篇: 在GitHub存储库中创建一个标签