Delete all Tags and Releases on Git and GitHub

Maybe you forked a repository on GitHub and it carried over all the existing releases and tags. For whatever reason you must now delete a large amount of tags from your Git repository. While GitHub provides a web interface for doing so it must be done one tag at a time.


  • Standard sh compatible shell.
  • The git cli client or command must be installed.
  • This was tested on Linux, FreeBSD, and MacOS X
  • Windows users should try using Cygwin
    • There is a better way

      Make a new local copy of the repository using git clone. Then switch into it.

      git clone project-copy
      cd project-copy/

      To prevent from being prompted for a username, email address, and password make sure you have setup some initial configuration values. If you already have this setup feel free to skip over.

      Setup name and email

      git config "Your Name"
      git config ""

      Create a .netrc file in your home directory containing the remote server name, your login, and password. For example, if using GitHub:

      touch ~/.netrc
      echo "# GitHub Automatic Login" >> ~/.netrc
      echo "machine" >> ~/.netrc
      echo "login your_github_username" >> ~/.netrc
      echo "password your_github_password" >> ~/.netrc
      echo "" >> ~/.netrc

      Then use the following set of commands on that new copy to delete all the tags and save the changes to remote.

      TAGS=$(git tag);
      git tag -d $TAGS;
      for TAG in $TAGS; do git push origin :refs/tags/$TAG; done;

      After a few minutes (depending on how much there is to delete) all the tags will be irreversibly gone.