Fixing “already exists” When Pushing a Git Tag
When git push of a release tag such as v1.0.0 shows ! [rejected] v1.0.0 -> v1.0.0 (already exists), the remote already has a tag with the same name that points to different content. Decide which tag is correct and fix the side that is wrong, and the error goes away.
If the remote tag is correct, delete the local tag and fetch it again from the remote. If the local tag is correct, either create it again under a different name, or replace the remote tag with --force.
The test environment was Ubuntu 24.04, Git 2.43.0, and bash 5.2. I ran commands with LANG=C so the messages would be in English. The remote was a local bare repository created in the same environment, registered with the relative path ../remote.git. I cloned this bare repository into two working directories, work and other. I did not test how protection settings or other options on hosting services such as GitHub affect the behavior.
- 1. Pushing a tag is rejected when the same name already exists on the remote
- 2. Compare the local and remote tags
- 3. If the remote tag is correct, delete the local tag and fetch it again
- 4. If the local tag is correct, create it again under a different name
- 5. Replace the remote tag while keeping the same name
Pushing a tag is rejected when the same name already exists on the remote
First, I created v1.0.0 in other and pushed it. Then, in work, which had not fetched, I made a fix commit and tagged that commit with the same v1.0.0, then pushed. The exit code was 1.
$ git tag -a v1.0.0 -m "バージョン 1.0.0"
$ git push origin v1.0.0
To ../remote.git
! [rejected] v1.0.0 -> v1.0.0 (already exists)
error: failed to push some refs to '../remote.git'
hint: Updates were rejected because the tag already exists in the remote.
The hint: line means that the update was rejected because the tag already exists on the remote.

The refspec description in the official git push reference says that every update to a tag (refs/tags/*) is rejected. A branch (refs/heads/*) can be updated if the new commit is a continuation of the current one (a fast-forward). Tags cannot be updated even in that case. In my test, the local v1.0.0 pointed to a commit that continued the remote v1.0.0, and it was still rejected.
When I pushed all tags with git push origin --tags, the new tag v1.0.1 was sent, and only v1.0.0 was rejected. The exit code was also 1 in this case.
$ git push origin --tags
To ../remote.git
* [new tag] v1.0.1 -> v1.0.1
! [rejected] v1.0.0 -> v1.0.0 (already exists)
error: failed to push some refs to '../remote.git'
hint: Updates were rejected because the tag already exists in the remote.
Compare the local and remote tags
Before fixing anything, check which commit each tag points to. You can see the local tag with git rev-parse, and the remote tag with git ls-remote --tags.
$ git rev-parse v1.0.0 "v1.0.0^{commit}"
a1b518fc3b105134d991e352bdec4d7ef2a80a59
678efaa36d359a93a38929bb8e5882b5c5ef11e6
$ git ls-remote --tags origin
5d2adf822b68640db5ec370da82420e2a9c0c0e7 refs/tags/v1.0.0
38252cf09f1de214348ea94d59952265c1135532 refs/tags/v1.0.0^{}
90bce86eeb7774b8e92cea95c18eb9feeb252659 refs/tags/v1.0.1
678efaa36d359a93a38929bb8e5882b5c5ef11e6 refs/tags/v1.0.1^{}
As the official git tag reference describes, an annotated tag created with git tag -a is a tag object that stores the creation date and a message. So the tag's own hash (v1.0.0) differs from the hash of the commit it points to (v1.0.0^{commit}). The gitrevisions description says ^{} refers to the object the tag resolves to, so in the git ls-remote output, the line ending in ^{} is the commit the tag points to. The local v1.0.0 points to commit 678efaa, and the remote v1.0.0 points to commit 38252cf, so they disagree.
Running git fetch origin here printed nothing and exited with code 0. The local v1.0.0 kept pointing to 678efaa, so the mismatch was not noticed. The mismatch only appeared as an error when I tried to fetch all remote tags with --tags.
$ git fetch origin --tags
From ../remote
! [rejected] v1.0.0 -> v1.0.0 (would clobber existing tag)
would clobber existing tag means that fetching would overwrite the tag that already exists locally. According to the refspec description in the official git fetch reference, since Git 2.20, fetch also rejects tag updates like push does, unless you use + or --force.
If the remote tag is correct, delete the local tag and fetch it again
If the remote v1.0.0 is correct and the one you created locally is wrong, delete the local tag with git tag -d, then fetch it from the remote.
$ git tag -d v1.0.0
Deleted tag 'v1.0.0' (was a1b518f)
$ git fetch origin --tags
From ../remote
* [new tag] v1.0.0 -> v1.0.0
The local v1.0.0 now points to commit 38252cf, the same as the remote. Running git push origin v1.0.0 again printed Everything up-to-date and exited with code 0, so the error no longer appeared. git push origin --tags also behaves the same way.
$ git rev-parse "v1.0.0^{commit}"; git ls-remote --tags origin "v1.0.0*"
38252cf09f1de214348ea94d59952265c1135532
5d2adf822b68640db5ec370da82420e2a9c0c0e7 refs/tags/v1.0.0
38252cf09f1de214348ea94d59952265c1135532 refs/tags/v1.0.0^{}
$ git push origin v1.0.0
Everything up-to-date
$ git push origin --tags
Everything up-to-date
You can also fix it without git tag -d by overwriting the local tag with the remote one using git fetch origin --tags --force. In my test, I started from a state where I had re-created an annotated tag on the same commit with git tag -f. The commit was the same, but the tag object was new and had a different message, so the push was rejected with the same already exists error. Fetching with --force showed t [tag update] and replaced the local tag, and the push error went away.
$ git tag -f -a v1.0.0 -m "バージョン 1.0.0(付け直し)" "v1.0.0^{commit}"
Updated tag 'v1.0.0' (was 5d2adf8)
$ git push origin v1.0.0
To ../remote.git
! [rejected] v1.0.0 -> v1.0.0 (already exists)
error: failed to push some refs to '../remote.git'
hint: Updates were rejected because the tag already exists in the remote.
$ git fetch origin --tags --force
From ../remote
t [tag update] v1.0.0 -> v1.0.0
$ git push origin v1.0.0
Everything up-to-date
--tags --force overwrites every local tag whose name collides with a remote tag. If there are other tags where you want to keep the local version, it is safer to delete the tags you want to replace one at a time with git tag -d.
If the local tag is correct, create it again under a different name
The remote v1.0.0 may point to the wrong commit while the local one is correct. In this case, the “On Re-tagging” section of the official git tag reference recommends, as the safest approach, using a different name such as X.1. If you change the content but keep the same name, people who have the old tag and people who have the new one will have different content under the same "version X".
In my test, v1.0.1 was already in use, so I tagged the fixed commit as v1.0.2 and pushed it. Because the name was new, it was pushed without problems.
$ git tag -a v1.0.2 -m "バージョン 1.0.2" main
$ git push origin v1.0.2
To ../remote.git
* [new tag] v1.0.2 -> v1.0.2
Replace the remote tag while keeping the same name
When you really must keep the same name, for example when you know nobody is using the tag yet, you can replace the remote tag. There are two ways to do it.
Push with –force
The first way is to push with --force. As the official git push reference says, the "rejected update" rule in the refspec description is ignored when --force is used. I moved the local v1.0.0 to the fixed commit (main) and pushed it. Git showed (forced update), and the remote v1.0.0 then pointed to commit 678efaa, the same as main.
$ git tag -f -a v1.0.0 -m "バージョン 1.0.0(修正後のコミット)" main
Updated tag 'v1.0.0' (was 5d2adf8)
$ git push --force origin v1.0.0
To ../remote.git
+ 5d2adf8...e9ecbbb v1.0.0 -> v1.0.0 (forced update)
$ git ls-remote --tags origin "v1.0.0*"
e9ecbbbd1112e2b6d0e7d4f8d4e4336a128650a9 refs/tags/v1.0.0
678efaa36d359a93a38929bb8e5882b5c5ef11e6 refs/tags/v1.0.0^{}
$ git push origin v1.0.0
Everything up-to-date
Fetch again on the side that has the old tag
Right after I replaced the remote tag with --force, I fetched in other, which still had the old v1.0.0 (commit 38252cf). A plain git fetch origin brought in the branch and the new tag v1.0.1, but v1.0.0 stayed at the old commit, and there was no error. With --tags, it was rejected with would clobber existing tag. With --tags --force, it was replaced with the new tag.
$ git fetch origin
From ../remote
38252cf..678efaa main -> origin/main
* [new tag] v1.0.1 -> v1.0.1
$ git fetch origin --tags
From ../remote
! [rejected] v1.0.0 -> v1.0.0 (would clobber existing tag)
$ git fetch origin --tags --force
From ../remote
t [tag update] v1.0.0 -> v1.0.0
$ git rev-parse "v1.0.0^{commit}"
678efaa36d359a93a38929bb8e5882b5c5ef11e6
The v1.0.0 in other now points to commit 678efaa, the same as the remote. A following git fetch origin --tags printed nothing and exited with code 0.
Delete the remote tag and push it again
Another way is to delete the remote tag with git push origin --delete, then push it again. In my test, I re-created v1.0.0 on main with a different message, confirmed that the push was rejected, and then tried this. After deleting the remote tag, I could push it as a new tag.
$ git tag -f -a v1.0.0 -m "バージョン 1.0.0(もう一度付け直し)" main
Updated tag 'v1.0.0' (was e9ecbbb)
$ git push origin v1.0.0
To ../remote.git
! [rejected] v1.0.0 -> v1.0.0 (already exists)
error: failed to push some refs to '../remote.git'
hint: Updates were rejected because the tag already exists in the remote.
$ git push origin --delete v1.0.0
To ../remote.git
- [deleted] v1.0.0
$ git push origin v1.0.0
To ../remote.git
* [new tag] v1.0.0 -> v1.0.0
$ git push origin v1.0.0
Everything up-to-date
--delete removes a tag from the remote (official git push reference). After pushing again, git ls-remote --tags origin showed that the remote v1.0.0 pointed to commit 678efaa, the same as main.
Replacing a remote tag does not change the local copies of people who have already fetched the old tag. If someone has taken the release contents from that tag, they will now be using different content under the same name. If you replace a tag, notify the people who use it.
When you see already exists, compare the commits that the local and remote tags point to using git rev-parse "タグ名^{commit}" and git ls-remote --tags origin. If the remote is correct, delete the local tag and fetch it again. If the local one is correct, use a tag with a different name, or replace the remote tag after notifying people.




