Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. # Setup repo deploy key to allow private NPM Package hosted on Github.com be read by CircleCI
  2.  
  3. Takes about 2 minutes
  4.  
  5. ## 1. Add the private package to your project and test the git link
  6.  
  7.  
  8. ### GitHub, private repo:
  9.  
  10. ```
  11. $ npm install git+ssh://git@github.com/username/my-new-project.git#master
  12. ```
  13.  
  14. ## 2. Setup Deploy Key for the private Github Repo
  15.  
  16. 1. Open Git Bash.
  17.  
  18. 2. Paste the text below, substituting in your GitHub email address.
  19.  
  20. ```
  21. $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  22.  
  23. ## when prompt, save the key as /home/username/.ssh/reponame_rsa
  24. ```
  25.  
  26. 3. Copy the content of the generated public key (~/.reponame_rsa.pub)
  27.  
  28. 4. Visit your repo > Settings > Deploy Keys > Add Deploy Key
  29.  
  30. 5. Paste the copied content and named the key as `CI Deploy Key`
  31.  
  32. ## 3. Login to CircleCI and add the private SSH key as 'SSH Keys'
  33.  
  34. 1. Login to CircleCI
  35.  
  36. 2. Go to Project > Project Settings > SSH Permissions > Add SSH Keys
  37.  
  38. 3. For Hostname, enter `github.com`
  39.  
  40. 4. For Private Key, paste from the content of `~/.ssh/reponame_rsa` (YES, the PRIVATE KEY)
  41.  
  42. ## 4. Update your CI script to add the SSH Keys
  43.  
  44. Examples
  45.  
  46. ```
  47. steps:
  48. - add_ssh_keys:
  49. fingerprints:
  50. - "b7:35:a6:4e:9b:0d:6d:d4:78:1e:9a:97:2a:66:6b:be"
  51. ```
  52.  
  53. OR
  54.  
  55. ```
  56. steps:
  57. # adds default ssh key for this project
  58. - add_ssh_keys
  59. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement