# Caching private gems efficiently

**URL:** <https://discuss.circleci.com/t/caching-private-gems-efficiently/5252>\
**Category:** Tips, Tricks, and Hacks\
**Tags:** rails, ruby, bundler\
**Created:** [July 21, 2016, 1:37pm UTC](https://discuss.circleci.com/t/caching-private-gems-efficiently/5252 "2016-07-21T13:37:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacob-s-son](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/jacob-s-son/32/13459_2.png) [@jacob-s-son](https://discuss.circleci.com/u/jacob-s-son)\
**Post date:** [July 21, 2016, 1:37pm UTC](https://discuss.circleci.com/t/caching-private-gems-efficiently/5252/1 "2016-07-21T13:37:48Z")

</div>

At ScoutRFP we use GH auth tokens to fetch private gems on our servers via HTTPS. At first I’ve decided to employ the same strategy when moving our builds to CircleCI. It was working fine except the one thing - `bundle check` , was always failing, causing to run `bundle install` each time. What was even more frustrating it would never install anything new (everything was cached).

The issue was solved as soon as I’ve added SSH keys to our CI user on GH, and used the git protocol to fetch private gems. Now it takes 2 seconds instead of 26 seconds, to verify the bundle.

```bash
bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 
The Gemfile's dependencies are satisfied

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:42am UTC](https://discuss.circleci.com/t/caching-private-gems-efficiently/5252/2 "2018-06-18T11:42:07Z")

</div>

Closed on June 18, 2018, 11:42am UTC


