Last active
June 3, 2022 15:09
-
-
Save loujaybee/92256907ee838ea8068b25dd61cb43b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- node convert-key.js | |
var fs = require("fs"); | |
var stdinBuffer = fs.readFileSync(0); // STDIN_FILENO = 0 | |
const key = stdinBuffer.toString() | |
const start = "-----BEGIN RSA PRIVATE KEY----- "; | |
const end = "-----END RSA PRIVATE KEY-----"; | |
const rawKey = key.replace(start, '').replace(end, '').replaceAll(' ', '\n').slice(0,-2).concat(end).replace (/^/, `${start}\n`); | |
console.log(rawKey); | |
--- gitpod.yml | |
tasks: | |
- name: "ssh" | |
command: > | |
echo $PEM | node convert-key.js >> temp.pem && | |
chmod 600 temp.pem && | |
gp sync-done download-key && | |
ssh -i temp.pem ubuntu@website.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment