Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR git-tag does not exist #23

Open
heshunwq opened this issue May 28, 2018 · 11 comments · May be fixed by #187
Open

ERROR git-tag does not exist #23

heshunwq opened this issue May 28, 2018 · 11 comments · May be fixed by #187

Comments

@heshunwq
Copy link

heshunwq commented May 28, 2018

Expected Behavior

when i run git-chglog or with other parameters, it always print:
⌚️ Generating changelog ...
ERROR git-tag does not exist

Your Environment

  • OS: maxos 10.13.4
  • git-chglog version: 0.7.0
@Beace
Copy link

Beace commented Jul 1, 2018

You can use git fetch origin --prune --tags to sync remote tags to your local. If you do not have any tag, you should git tag xxx to create tag.

@esbobkov
Copy link

 ERROR  failed to get git-tag: exit status 128

git fetch origin --prune --tags doesn't help

@23ewrdtf
Copy link

I have the same issue, tried whatever I could but no luck.

I do:

$ mkdir some_repo
$ git-chglog --init
? What is the URL of your repository? https://github.com/repo/repo.git
? What is your favorite style? github
? Choose the format of your favorite commit message <type>(<scope>): <subject>
? What is your favorite template style? keep-a-changelog
? Do you include Merge Commit in CHANGELOG? No
? Do you include Revert Commit in CHANGELOG? No
? In which directory do you output configuration files and templates? .chglog

✨  Configuration file and template generation completed!
  ✔ .chglog/config.yml
  ✔ .chglog/CHANGELOG.tpl.md

$ git clone https://github.com/repo/repo.git

$ git-chglog -o CHANGELOG.md
⌚️  Generating changelog ...
 ERROR  failed to get git-tag: exit status 128

@puppeteer701vungle
Copy link

Any news on this issue?

@jhulten
Copy link

jhulten commented Dec 11, 2019

git-chglog depends on their being tags in your repo identifying releases.

If you run git tag do you get anything back? If not, you have no tags to generate a change log from.

See something like https://dev.to/neshaz/a-tutorial-for-tagging-releases-in-git-147e for ideas on how to manage tagging as part of your release process.

@bartlibert
Copy link

The problem is not that git tag does not work or that there are no tags, the problem is that the git-tag (notice the hyphen!) program is not in the executable path.

Most of the time, users will use git tag to work with tags, but internally, this is relayed to git-tag in the "git-core" folder. Some distributions put this folder in the PATH variable, but others don't.

This tool uses git-tag instead of git tag (there might be a reason for this, IMHO non-standard way of using git, I'm curious about it), so if the git-core path is not in the user's PATH, git-chglog will not work.

Some possible solutions:

  • Use git tag instead of git-tag
  • Use git ---exec-path to determine the git-core path and use that to call git-tag
  • Force users to add git-core to their path

@tamsky
Copy link

tamsky commented May 21, 2021

This error has nothing to do with the exec() call to git or any other binary.

My suggestion for a better message might be: ERROR no tags found.

ERROR git-tag does not exist is emitted here only when len(tags) == 0.

git-chglog gathers tags using git for-each-ref(see footnote [1]) -- it does not invoke git-tags, or git tags.


If you're using git clone -depth 1, this the likely culprit behind the ERROR.
In my case, I was trying to use the Github Action:

    uses: actions/checkout@v2                                                                       

this action has a default value of depth: 1.

I needed to add:

    with:                                                                                           
      fetch-depth: 0                                                                                

to eliminate this error.

[1] Use of git for-each-ref ::

git-chglog/tag_reader.go

Lines 30 to 36 in bc0f363

func (r *tagReader) ReadAll() ([]*Tag, error) {
out, err := r.client.Exec(
"for-each-ref",
"--format",
"%(refname)"+r.separator+"%(subject)"+r.separator+"%(taggerdate)"+r.separator+"%(authordate)",
"refs/tags",
)

@Constantin07
Copy link

In my case a have a history full of tags:

$ git tag
0.1
...
0.10
0.100
0.101
...
.130-20211018110454.c07b664-SNAPSHOT
0.130
..
0.131-20211019090556.0596eb9-SNAPSHOT
0.132
...

but it still fails with the above error when I filter by release tags:

options:
  # report only on released versions (skip snapshots)
  tag_filter_pattern: '^\d\.\d\$'

and it works just fine when I comment it out. Looks like it doesn't like something in tag names ...

$ git-chglog -v
git-chglog version 0.15.1

Same behaviour on MacOS Monerey 12.6.1 and in Docker Linux Alpine 3.15 container.

@notjames
Copy link

notjames commented Feb 24, 2023

In my case a have a history full of tags:

$ git tag
0.1
...
0.10
0.100
0.101
...
.130-20211018110454.c07b664-SNAPSHOT
0.130
..
0.131-20211019090556.0596eb9-SNAPSHOT
0.132
...

but it still fails with the above error when I filter by release tags:

options:
  # report only on released versions (skip snapshots)
  tag_filter_pattern: '^\d\.\d\$'

and it works just fine when I comment it out. Looks like it doesn't like something in tag names ...

$ git-chglog -v
git-chglog version 0.15.1

Same behaviour on MacOS Monerey 12.6.1 and in Docker Linux Alpine 3.15 container.

I am in the same boat. I have versions, but am still getting the error:

✦ at 14:11:31 ❯ g tag --list
NO-v1.0.0
v1.0.0
v1.0.1
✦ at 14:11:26 ❯ g chglog --tag-filter-pattern v1.0.0..v1.0.1
 ERROR  git-tag does not exist

Seems it might be my use of the --tag-filter-pattern argument. If that's the case, then I would still call this a bug.

@sandrogattuso
Copy link

here an additional case that I found presenting this error:

 ERROR  failed to get git-tag: exit status 128

Scenario: execution on GitHub Actions.
In my case it turned out to be an issue with the git configuration on the container that was causing the command git for-each-ref refs/tags to throw this error

fatal: detected dubious ownership in repository at '/__w/<REPO_PATH>'
To add an exception for this directory, call:

	git config --global --add safe.directory /__w/<REPO_PATH>
Error: Process completed with exit code 128.

Basically the actual error has been swollen by the tool and I suspect that this can happen for any type of error.
It would probably be worth it to look at how the error is propagate by the git client and amend that part to report the full error

@romanbonapart
Copy link

I added git config --global --add safe.directory "$GITHUB_WORKSPACE" before checkout to fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.