title: Heroku pull private github repository
body: <p>I have tryed different approaches to use a Github private repository reference in a Rails application <strong>Gemfile</strong>.</p>
  
  <pre><code>1) Gemfile:
  gem 'my_gem', :git =&gt; "https://#{github_user}:#{github_pw}@github.com/me/my_gem.git"
  </code></pre>
  
  <p>Result from 'git push heroku':</p>
  
  <pre><code>Fetching https://user:pw@github.com/me/my_gem.git
  error: The requested URL returned error: 401 while accessing https://user:pw@github.com/me/my_gem.git/info/refs
  Git error: command `git clone 'https://user:pw@github.com/me/my_gem.git' "/tmp/build_2wxmqutch8gy7/vendor/bundle/jruby/1.9/cache/bundler/git/my_gem-929bddeee3dd4a564c2689e189190073df01431e" --bare --no-hardlinks` in directory /tmp/build_2wxmqutch8gy7 has failed.
  Dependencies installed
  </code></pre>
  
  <p>Then I found this article <a href="https://help.github.com/articles/creating-an-oauth-token-for-command-line-use" rel="noreferrer">https://help.github.com/articles/creating-an-oauth-token-for-command-line-use</a> and created an OAuth token.</p>
  
  <pre><code>2) Gemfile:
  gem 'my_gem', :git =&gt; "https://#{github_oauth_token}@github.com/me/my_gem.git"
  </code></pre>
  
  <p>Result from 'git push heroku':</p>
  
  <pre><code>Fetching https://0123456789abcdef0123456789abcdef01234567@github.com/me/my_gem.git
  Password:
  </code></pre>
  
  <p>Heroku stall and prompt for a password.</p>
  
  <p>On my local machine both:</p>
  
  <pre><code>git clone https://user:pw@github.com/me/my_gem.git
  </code></pre>
  
  <p>and</p>
  
  <pre><code>git clone https://0123456789abcdef0123456789abcdef01234567@github.com/me/my_gem.git
  </code></pre>
  
  <p>works perfekt!</p>
  
  <p>Local:</p>
  
  <pre><code># git --version
  git version 1.7.9.5
  </code></pre>
  
  <p>Heroku:</p>
  
  <pre><code># heroku run git --version
  git version 1.7.0
  </code></pre>