Configure private gem publishing via gemspec metadata
mainTo publish to a private server instead of the public RubyGems, add the allowed_push_host key to your gem's metadata. This prevents accidental public publishing and tells Gemsmith which credentials to use from your $HOME/.gem/credentials file.
Note: The keys and values in the metadata must be strings.
Gem::Specification.new do |spec|
spec.metadata = {"allowed_push_host" => "https://private.example.com"}
end