Interview Prep/Git & GitHub/Push, Pull and Fetch Errors

`! [rejected] v1.2.0 -> v1.2.0 (already exists)` when pushing a tag.

IntermediateTroubleshootingPush, Pull and Fetch Errors
Answer

Likely causes → A tag with that name exists on the remote pointing to a different commit.

Diagnose →

git ls-remote --tags origin v1.2.0
git rev-parse v1.2.0^{}

Fix → If the remote tag is correct, fetch it (git fetch origin tag v1.2.0) and stop. If you really need to move it and nobody consumed it, git push origin :refs/tags/v1.2.0 then re-push. Otherwise use a new version.

Prevent → Make tags immutable with a tag ruleset, and let CI create release tags.

All Git & GitHub questions Roadmap: Git & GitHub

More on Push, Pull and Fetch Errors