File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff 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!"
You can’t perform that action at this time.
0 commit comments