In a python script, I am trying to validate a tag after cloning a git repository. I am using GitPython 0.3.2.
#!/usr/bin/env python import git g = git.Git() g.clone(" user@host :repos") g = git.Git(repos) g.execute(["git", "checkout", "tag_name"])
With this code, I have an error:
g.execute(["git", "checkout", "tag_name"]) File "/usr/lib/python2.6/site-packages/git/cmd.py", line 377, in execute raise GitCommandError(command, status, stderr_value) GitCommandError: 'git checkout tag_name' returned exit status 1: error: pathspec 'tag_name' did not match any file(s) known to git.
If I replace the tag name with the branch name, I have no problem. I did not find the information in the GitPython documentation. And if I try to check the same tag in the shell, I have a problem.
Do you know how can I check the git tag in python?
source share