You may try
# list the sources
gem sources -l
# remove a source
gem sources -r https://rubygems.org/
# add an alternative source
gem sources -a https://gems.ruby-china.com/
The above shows my steps to replace the default gem source, because the connection to rubygems.org
is unstable here