Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. ## Setting up the Secrets Submodule
  2.  
  3. First, `cd` into your `career_arc` repo and pull the latest changes...
  4.  
  5. ```bash
  6. > cd ~/repos/career_arc
  7. > git pull
  8. ```
  9.  
  10. Next, initalize the git submodules feature:
  11.  
  12. ```bash
  13. > git submodule init
  14. Submodule 'secrets' (deploy@10.0.2.80:repos/secrets.git) registered for path 'secrets'
  15. > git submodule update
  16. Cloning into 'secrets'...
  17. remote: Counting objects: 26, done.
  18. remote: Compressing objects: 100% (17/17), done.
  19. remote: Total 26 (delta 8), reused 0 (delta 0)
  20. Receiving objects: 100% (26/26), 4.66 KiB | 0 bytes/s, done.
  21. Resolving deltas: 100% (8/8), done.
  22. Checking connectivity... done.
  23. Submodule path 'secrets': checked out '952dacab5a554d873a8127ad59808591fdb77c39'
  24. ```
  25.  
  26. You'll notice that a new subdirectory called "secrets" has been added to your repo. It is the submodule in which we'll store the secrets.yml file. Let's checkout master on the submodule so that we're ready to make changes as needed:
  27.  
  28. ```bash
  29. > cd secrets
  30. > git checkout master
  31. > git pull
  32. > cd ..
  33. ```
  34.  
  35. Now we can replace the normal config/secrets.yml file with a symlink to the shared secrets file:
  36.  
  37. ```bash
  38. > cd config
  39. > rm secrets.yml
  40. > ln -s ../secrets/secrets.yml secrets.yml
  41. > cd ..
  42. ```
  43.  
  44. Lastly, we need to add a git hook to automatically update subrepos whenever we pull changes in our main repo:
  45.  
  46. ```bash
  47. > vi .git/hooks/post-merge
  48. ```
  49.  
  50. Paste in the contents of the post-merge script included below, then save and close the file. Next, mark the file as executable:
  51.  
  52. ```bash
  53. > chmod 775 .git/hooks/post-merge
  54. ```
  55.  
  56. You should now be good to go!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement