First, cd
into your career_arc
repo and pull the latest changes...
> cd ~/repos/career_arc
> git pull
Next, initalize the git submodules feature:
> git submodule init
Submodule 'secrets' ([email protected]:repos/secrets.git) registered for path 'secrets'
> git submodule update
Cloning into 'secrets'...
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 26 (delta 8), reused 0 (delta 0)
Receiving objects: 100% (26/26), 4.66 KiB | 0 bytes/s, done.
Resolving deltas: 100% (8/8), done.
Checking connectivity... done.
Submodule path 'secrets': checked out '952dacab5a554d873a8127ad59808591fdb77c39'
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:
> cd secrets
> git checkout master
> git pull
> cd ..
Now we can replace the normal config/secrets.yml file (and others) with a symlink to the shared secrets file:
> cd config
> rm secrets.yml
> ln -s ../secrets/secrets.yml secrets.yml
> ln -s ../secrets/adp_signing.crt adp_signing.crt
> ln -s ../secrets/adp_signing.key adp_signing.key
> ln -s ../secrets/brakeman.ignore brakeman.ignore
> ln -s ../secrets/database.yml database.yml
> ln -s ../secrets/ga_client_secret.json ga_client_secret.json
> ln -s ../secrets/shards.yml shards.yml
> cd ..
Lastly, we need to add a git hook to automatically update subrepos whenever we pull changes in our main repo:
> vi .git/hooks/post-merge
Paste in the contents of the post-merge script included below, then save and close the file. Next, mark the file as executable:
> chmod 775 .git/hooks/post-merge
You should now be good to go!