Update: This issue is now fixed. As noted in the comments by Erik Michaels-Ober, patch has been committed and deployed to the API of Rubygems website.

I built a very small gem yesterday for translating model fields stored in the same model model_fields_i18n and was trying to push it to Rubygems, but was getting this error:

$ gem push pkg/model_fields_i18n-0.0.1.gem 
Pushing gem to https://rubygems.org...
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    too many connection resets (https://rubygems.org/api/v1/gems)

Trying different connections didn’t helped and also Google search didn’t reveal anything. But, today I found a very fresh solution on Rubygems support page which I think is worth sharing here. So, when you try pushing a gem to Rubygems using:

$ gem push model_fields_i18n-0.0.1.gem

gem push command asks you for your credentials which if you set correctly, they will be stored in the ~/.gem/credentials file and in a wrong format like:

--- 
:rubygems_api_key: "{\"rubygems_api_key\":\"1234567890\"}"

To fix the issue, you need to change the format as:

--- 
:rubygems_api_key: "1234567890"

Then you can successfully push your gem to Rubygems.

$ gem push pkg/model_fields_i18n-0.0.1.gem 
Pushing gem to https://rubygems.org...
Successfully registered gem: model_fields_i18n (0.0.1)

On the other note, if you want to build your own gem with the latest best practices in mind, I recommend reading this great Extending Active Record blog post by Ryan Bigg and also you can check New Gem with Bundler Railscast.