Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Setup repo deploy key to allow private NPM Package hosted on Github.com be read by CircleCI
- Takes about 2 minutes
- ## 1. Add the private package to your project and test the git link
- ### GitHub, private repo:
- ```
- $ npm install git+ssh://git@github.com/username/my-new-project.git#master
- ```
- ## 2. Setup Deploy Key for the private Github Repo
- 1. Open Git Bash.
- 2. Paste the text below, substituting in your GitHub email address.
- ```
- $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- ## when prompt, save the key as /home/username/.ssh/reponame_rsa
- ```
- 3. Copy the content of the generated public key (~/.reponame_rsa.pub)
- 4. Visit your repo > Settings > Deploy Keys > Add Deploy Key
- 5. Paste the copied content and named the key as `CI Deploy Key`
- ## 3. Login to CircleCI and add the private SSH key as 'SSH Keys'
- 1. Login to CircleCI
- 2. Go to Project > Project Settings > SSH Permissions > Add SSH Keys
- 3. For Hostname, enter `github.com`
- 4. For Private Key, paste from the content of `~/.ssh/reponame_rsa` (YES, the PRIVATE KEY)
- ## 4. Update your CI script to add the SSH Keys
- Examples
- ```
- steps:
- - add_ssh_keys:
- fingerprints:
- - "b7:35:a6:4e:9b:0d:6d:d4:78:1e:9a:97:2a:66:6b:be"
- ```
- OR
- ```
- steps:
- # adds default ssh key for this project
- - add_ssh_keys
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement