I have a private repository on Github that I want to use. I deploy my app to Heroku. How can I specify a private repository as the source on my gemfile? I imagine it wouldn't be enough to simply say
gem "mygem", :git=>"my github address"
Under your repository name, click Settings. In the "Access" section of the sidebar, click Collaborators & teams. Click Invite a collaborator. In the search field, start typing the name of person you want to invite, then click a name in the list of matches.
Private repository data is scanned by machine and never read by GitHub staff. Human eyes will never see the contents of your private repositories, except as described in our Terms of Service. Your individual personal or repository data will not be shared with third parties.
The best way I've found to deploy a gem pulled from a private repo is to use GitHub's OAuth access. To do so:
Create a GitHub user with access to the repo in question (best for teams – if you're okay exposing your personal access tokens, you can simply use your own account).
Create an GitHub OAuth token for the user. It's dead simple to do this over the GitHub API just using curl
; see the OAuth API for more.
Add the token to the git
url in your Gemfile. Example:
gem 'mygem', git: 'https://xxx123abc:[email protected]/user_or_team/mygem.git'
I'm currently using this method on Heroku and it works great. The beauty is that you don't have to expose your own personal information, and you can revoke or regenerate the token at any point if something is compromised.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With