gem push "Repushing of gem versions is not allowed" in CI
rubygems.org already has the version you are pushing, and it does not allow overwriting a published gem version. The release needs a new version in the gemspec.
What this error means
gem push fails with "Repushing of gem versions is not allowed. Please use gem yank to remove bad gem releases." after a successful upload of that version earlier.
gem
Pushing gem to https://rubygems.org...
Repushing of gem versions is not allowed.
Please use `gem yank` to remove bad gem releases.Common causes
The gem version was not bumped
The gemspec version already exists on rubygems.org. Published versions are immutable, so the push is rejected.
A re-run of an already-successful release
Re-running the release pushes the same built .gem again, which the registry refuses.
How to fix it
Bump the version and rebuild the gem
- Update the version constant or gemspec version.
- Rebuild with
gem buildso the .gem carries the new version. - Push the new .gem.
Terminal
gem build my_gem.gemspec
gem push my_gem-1.2.1.gemYank only to remove a broken release
You cannot repush, but you can gem yank a bad version. Yanking does not free the version for reuse; still publish a new number.
Terminal
gem yank my_gem -v 1.2.0How to prevent it
- Publish only from a tagged release with a fresh version.
- Automate the gemspec version bump in the release flow.
- Treat published gem versions as permanent.
Related guides
gem push "401 ... Access Denied / bad authentication" in CIFix RubyGems "gem push" 401 authentication failures in CI - no valid API key reached rubygems.org; set GEM_HO…
npm publish "409 Conflict - cannot publish over previously published version" in CIFix "npm ERR! code E409 ... You cannot publish over the previously published versions" in CI - the version in…
cargo publish "crate version is already uploaded" in CIFix cargo "error: failed to publish ... crate version X.Y.Z is already uploaded" in CI - crates.io versions a…