Reputation: 91861
When attempting to Push via Source Tree, I get the following error:
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags origin refs/heads/master:refs/heads/master
Pushing to https://[email protected]/repo.git
To https://[email protected]/repo.git
= [up to date] master -> master
...
! [rejected] example_tag -> example_tag (already exists)
updating local tracking ref 'refs/remotes/origin/master'
error: failed to push some refs to 'https://[email protected]/repo.git'
hint: Updates were rejected because the tag already exists in the remote.
Completed with errors, see above
I didn't make any changes to this tag as far as I know. How can I fix this?
Upvotes: 209
Views: 142129
Reputation: 11
I've tried all above and none of them worked for me. And then I found the easiest way...on Mac
Open the hidden folder .git
of your repo, then refs
-> tags
, find the rejected tag, and delete it.
Back to Source Tree and click Fetch
-> Fetch and store all tags locally
, all should be fine.
Upvotes: 1
Reputation: 9119
You should also be able to solve this in git bash (click on "Terminal" button in the Source Tree UI). Type:
git pull --tags
If you have conflicting tags, you can include the -f
option in the command to override the local conflicting tags with their remote versions.
git pull --tags -f
Upvotes: 394
Reputation: 70126
git pull --tags
works really well but sometimes you can get an error even with this command. Example error message:
! [rejected] example_tag -> example_tag (would clobber existing tag)
This can be solved with the command: git pull --tags -f
-f
stands for force.
Source:
https://github.com/concourse/git-resource/issues/233
Upvotes: 54
Reputation: 115
In SourceTree, this seems to work:
Upvotes: 3
Reputation: 2954
Make sure you uncheck the "Push all tags" button while push.
Upvotes: 30
Reputation: 389
Uncheck push all tags
at the bottom of the UI when you confirm your git push
Upvotes: 38
Reputation: 91861
If you have not made any local changes to the tag that you want to keep, then you can remove tag that was rejected because it already exists (example_tag
in this case):
The reason this is common in SourceTree is because the Push all tags option is set to on by default. (Another way to hide this error is to uncheck that option.)
Upvotes: 144