get a list of all tags on a remote with gitpython

Viewed 214

I would like to get a sorted list of tags on a remote with gitpython.

The answer here gitpython-tags-sorted returns a list of the tags in the local repository.

My current solution to get the current tags from the remote is to run this command in the git shell before I list all tags with the solution above: git fetch --prune origin "+refs/tags/*:refs/tags/. How can I accomplish this with gitpython?

1 Answers

This gives a undecoded string with the tags on the remote and the commit associated

import git

repo = git.Repo("path_to_local_repo")

tagList=repo.git.ls_remote("--tags", "origin")
Related