Use Local RubyGems Repositories

JFrog Artifactory Documentation

JFrog Artifactory
Content Type
User Guide

First, setup the appropriate credentials for the gem tool: either include the API key in the ~/.gem/credentials file or issue this command:

Setting Up Credentials

curl http://localhost:8081/artifactory/api/gems/<repository key>/api/v1/api_key.yaml -u admin:password > ~/.gem/credentials

Running on Linux

You may need to change the permissions of the credentials file to 600 (chmod 600)

Running on Windows

The credentials file is located under %USERPROFILE%/.gem/credentials

You also need to set the API key encoding to be "ASCII". For example:

curl http://localhost:8081/artifactory/api/gems/<repository key>/api/v1/api_key.yaml | Out-File ~/.gem/credentials -Encoding "ASCII"

API keys

You can modify the credentials file manually and add different API keys. You can later use gem push -k key to choose the relevant API key.

In order to push gems to the local repository, you can set the global variable $RUBYGEMS_HOST to point to the local repository as follows:


export RUBYGEMS_HOST=http://localhost:8081/artifactory/api/gems/<repository key>

To get this value, select your repository in the Application module | Artifactory | Artifacts | Gems-local and click Set Me Up.


Alternatively you could use the gem push command with --host, and optionally, --key to specify the relevant API key.


Make sure you are familiar with your effective sources and their order as specified in the ~/.gemrc file.

Also, make sure you are familiar with your global $RUBYGEMS_HOST variable before you issue a gem push command or use the push --host option.

When a local repository is first created, it is populated with rubygems-update-*.gemby default. In order to disable this behavior, you must change the system properties to include:Artifactory Configuration Files


Make sure you deploy to a "gems" folder

When deploying Gems to your repositories, you need to place them in a gems folder for Artifactory to include them in its indexing calculations.