Interview Prep/Git & GitHub/GitHub, Actions and Pull Request Issues

`gh release create v1.2.0` fails with `tag v1.2.0 exists locally but has not been pushed to org/repo, please push it before continuing or specify the --target flag to create a new tag`.

BeginnerTroubleshootingGitHub, Actions and Pull Request Issues
Answer

Likely causes → You tagged locally but did not push the tag, so GitHub cannot attach a release to it.

Diagnose →

git ls-remote --tags origin v1.2.0
git show --no-patch v1.2.0

Fix →

git push origin v1.2.0
gh release create v1.2.0 --generate-notes

Prevent → Release from CI on tag push (on: push: tags: ['v*']), or use git push --follow-tags for annotated tags.

All Git & GitHub questions Roadmap: Git & GitHub

More on GitHub, Actions and Pull Request Issues