Reputation: 5565
So I'm setting up a really awesome hubot setup which will automatically deploy code from github to heroku, via a free heroku nodejs app. I'm having trouble checking out the repo properly on AWS. I created SSH keys on the remote box, had them working and verified it. Then, I added them as Heroku environment variables like this:
~$ heroku config:add PRIVATE_KEY="...
aoijsdfasoidjfasodijfasodifjaodsifjasdofija"
I then try to echo both the public and private keys back to their normal location in .ssh/id_rsa
, but they ask me for a passphrase, which I didn't set, and always fail.
Any idea how to successfully write a key to an environment variable? I think it's something to do with the linebreaks not showing up correctly.
Upvotes: 12
Views: 18145
Reputation: 359
If you would like to read from the key file, this works:
heroku config:set PRIVATE_KEY="$(cat id_rsa)"
Upvotes: 4
Reputation: 5565
AH! Of course.
If you do echo "$VAR"
it retains its formatting. Updating my scripts now.
(i had been working on this all day. Thank you rubber duck.)
Upvotes: 15