Skip to content

Commit 0ecfb7d

Browse files
authored
Update main.yml
1 parent 2c3456a commit 0ecfb7d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@ jobs:
1818
sudo apt-get update
1919
sudo apt-get install -y openssh-client
2020
21-
- name: Set up SSH Key
21+
- name: Set up SSH Key with Passphrase
2222
env:
23-
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} # The private key you stored in GitHub Secrets
23+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
24+
VM_PASSPHRASE: ${{ secrets.VM_PASSPHRASE }}
2425
run: |
2526
mkdir -p ~/.ssh
2627
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deployment_key
2728
chmod 600 ~/.ssh/deployment_key
29+
eval "$(ssh-agent -s)"
30+
echo "$VM_PASSPHRASE" | ssh-add ~/.ssh/deployment_key
2831
2932
- name: Add VM to known_hosts
3033
run: |
3134
ssh-keyscan -H ${{ secrets.VM_HOST }} >> ~/.ssh/known_hosts
3235
3336
- name: Test SSH Connection to VPS
3437
run: |
35-
ssh -i ~/.ssh/deployment_key dev@${{ secrets.VM_HOST }} "echo SSH connection successful!"
38+
ssh -o IdentitiesOnly=yes -i ~/.ssh/deployment_key dev@${{ secrets.VM_HOST }} "echo SSH connection successful!"

0 commit comments

Comments
 (0)