Skip to content
Latchkey

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

  1. Update the version constant or gemspec version.
  2. Rebuild with gem build so the .gem carries the new version.
  3. Push the new .gem.
Terminal
gem build my_gem.gemspec
gem push my_gem-1.2.1.gem

Yank 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.0

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →