Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH Key #6

Closed
taranvohra opened this issue Oct 1, 2019 · 16 comments
Closed

SSH Key #6

taranvohra opened this issue Oct 1, 2019 · 16 comments

Comments

@taranvohra
Copy link

I'm trying to use this action to ssh into my AWS EC2 Instance but I keep getting this error,
2019/10/01 09:51:51 ssh.ParsePrivateKey: ssh: no key found. I'm still not sure what contents do I need to add for the key in github secrets. I have the .pem private key from AWS

@taranvohra
Copy link
Author

Issue resolved. I had to use the contents of the private key.

@abhisheksoni27
Copy link

@taranvohra Can you elaborate what exactly you did to make this work? Do you have the *.pem file pushed to your repo?

@taranvohra
Copy link
Author

No don't push the .pem file. Open the file locally, copy its contents (it'll start with ---BEGIN RSA KEY something) then go to your repo settings, add secret and paste the contents there

@abhisheksoni27
Copy link

Awesome!

I tried that but it didn't quite work. Anyway, thanks a lot.

@slametkoala
Copy link

Issue resolved. I had to use the contents of the private key.

are u create ne user for store yus ssh key..? or u just create ssh key for default ec2 user "ubuntu"?

@chinedu117
Copy link

I encountered this problem but in my own situation the problem was solved by copying the entire content of cat ~/.ssh/id_rsa. Starting from and including the comment section -----BEGIN RSA PRIVATE KEY----- ....... to -----END RSA PRIVATE KEY-----. I hope this helps someone.

@usernotnull
Copy link

Adding to @chinedu117 's answer, this also means don't bother making the string fit one line, copy as is with the line breaks in the key.

@olandodeflexy
Copy link

Is it possible to use ppk private key? I have done all that is required but I am still getting this error.

@mrehman11
Copy link

Facing The Same But Fixed as mentioned in #188 Thank you

@foremtehan
Copy link

I had to use the contents of the private key.

But we shouldn't share private key? I learned this in school 🤔

@zakiego
Copy link

zakiego commented Mar 10, 2024

Adding to @chinedu117 's answer, this also means don't bother making the string fit one line, copy as is with the line breaks in the key.

image

I just realized that when inputting the SSH_KEY with the GitHub Action extension, it condenses it into one line, resulting in an error. When I manually input the secret through github.com, the SSH started working.

@quanglochuynh
Copy link

Adding to @chinedu117 's answer, this also means don't bother making the string fit one line, copy as is with the line breaks in the key.

image I just realized that when inputting the SSH_KEY with the GitHub Action extension, it condenses it into one line, resulting in an error. When I manually input the secret through github.com, the SSH started working.

Thank you a lot, that work for me, the GitHub Actions VSCode extension needs to fix that.

@ArpitBlagan
Copy link

I get the key from the pem file by opening it on terminal
-> cat dash.pem
then copy the secret and put in github secrets but on action: appleboy/ssh-action@master I am getting an error
-> ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error: Process completed with exit code 1.

@ideawolf
Copy link

I get the key from the pem file by opening it on terminal -> cat dash.pem then copy the secret and put in github secrets but on action: appleboy/ssh-action@master I am getting an error -> ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain Error: Process completed with exit code 1.

Check the version you are currently using: uses: appleboy/ssh-action@v1.0.3 and make sure it is the latest version.

@ArpitBlagan
Copy link

I get the key from the pem file by opening it on terminal -> cat dash.pem then copy the secret and put in github secrets but on action: appleboy/ssh-action@master I am getting an error -> ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain Error: Process completed with exit code 1.

Check the version you are currently using: uses: appleboy/ssh-action@v1.0.3 and make sure it is the latest version.

Thanks for replying but there was typo in github secret that time 🙏🏼

@malex30
Copy link

malex30 commented Mar 7, 2025

I get the key from the pem file by opening it on terminal -> cat dash.pem then copy the secret and put in github secrets but on action: appleboy/ssh-action@master I am getting an error -> ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain Error: Process completed with exit code 1.

Check the version you are currently using: uses: appleboy/ssh-action@v1.0.3 and make sure it is the latest version.

Thanks for replying but there was typo in github secret that time 🙏🏼

What was the typo?

mine is as followed

EC2_HOST=00.000.00.00
EC2_USERNAME=ubuntu
EC2_SSH_KEY="-----BEGIN RSA PRIVATE KEY-----
.........
iIYJTyvitGYDnAISjuXV9AbmklAYsoAArvzmoiH12+sVm7CD0fstsNF755/FfrgV
........
-----END RSA PRIVATE KEY-----"

when testing in act i get this:

[Test EC2 conn./test-connection] ⭐ Run Main Run entrypoint.sh
[Test EC2 conn./test-connection] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1-composite-entrypoint.sh] user= workdir=
| Will download drone-ssh-1.8.0-linux-amd64 from https://github.com/appleboy/drone-ssh/releases/download/v1.8.0
| ======= CLI Version =======
| Drone SSH version 1.8.0
| ===========================
| 2025/03/07 16:26:55 ssh.ParsePrivateKey: ssh: no key found
| 2025/03/07 16:26:55 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
[Test EC2 conn./test-connection] ❌ Failure - Main Run entrypoint.sh
[Test EC2 conn./test-connection] exitcode '1': failure
[Test EC2 conn./test-connection] ⚙ ::set-output:: stdout=
[Test EC2 conn./test-connection] ❌ Failure - Main Test EC2 Connection
[Test EC2 conn./test-connection] exitcode '1': failure

yml:

name: Test EC2 Connection
        uses: appleboy/ssh-action@v1.2.1
        with:
          host: ${{ secrets.EC2_HOST }}
          username: ${{ secrets.EC2_USERNAME }}
          key: ${{ secrets.EC2_SSH_KEY }}
          port: 22
          timeout: 60s
          script: |
            echo "Connection successful!"
            echo "User: $(whoami)"
            echo "Current directory: $(pwd)"
            echo "Python location: $(which python || echo 'Python not found')"
            echo "System info: $(uname -a)"

            # Check for UV installation
            if command -v uv &> /dev/null; then
              echo "UV is installed: $(uv --version)"
            else
              echo "UV is not installed"
            fi

            # Check directory structure
            echo "Home directory structure:"
            ls -la ~

appleboy added a commit that referenced this issue Mar 8, 2025
- Add instructions for copying the private key to GitHub Secrets in English, Chinese (Simplified), and Chinese (Traditional) versions of the README.

ref: #6 (comment)
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests