Bug: `fatal: not in a git directory`
Opened this issue ยท 12 comments
What happened
Ran the actions-ecosystem/action-push-tag@v1
Github Action unsuccessfully:
...
"/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/.../...":"/github/workspace" ...
12
fatal: not in a git directory
Probably related to:
https://stackoverflow.com/questions/71849415/cannot-add-parent-directory-to-safe-directory-on-git
https://news.ycombinator.com/item?id=31009675
What you expected to happen
Successfully pushed tags.
How to reproduce it
I think if you run a workflow with the action-push-tag
action this will happen.
Environment
@tokestermw can you please explain why you think it could be related to https://stackoverflow.com/questions/71849415/cannot-add-parent-directory-to-safe-directory-on-git and https://github.blog/2022-04-12-git-security-vulnerability-announced/?
action-push-tag
seems to use git version 2.34.2.
Facing same issue, was working perfectly before
Facing same issue, was working perfectly before
Yeah it was working before the linked issue. There is some chance it's unrelated, or indirectly related. Not exactly sure what the solution should be.
A workaround is to directly use the code in https://github.com/actions-ecosystem/action-push-tag/blob/main/entrypoint.sh using run
(instead of using uses
).
Something like:
- name: Tag
run: |
tag=${{ steps.bump-semver.outputs.new_version }}
message='${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}'
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a "${tag}" -m "${message}"
git push origin "${tag}"
I am running into this as well. Was working fine up until recently.
Any updates on this?
Hi Here ๐๐ผ
I'm facing the same issue
Could you please put a not on top of the docs that this action is currently broken? There are now quite a few people that seems to have spent time trying this out even though it's broken. Thanks!
I run into this right after I moved this action call to separate composite action.
I tried running pwd
and ls -la
in entrypoint.sh to try to find out which directory it ends up in, and I don't see that output in the GH action. Any ideas on how to debug what dir this action ends up in after checkout?
@micnncim - any help here would be great! Seems this has been broken since April of last year.
Since it seems that they're not maintaining actions ecosystem actions -- I published a working fork of this with added features.
https://github.com/marketplace/actions/push-any-git-tag