Open yarns123 opened 2 years ago
For those having the same issue.
I ran into this and fixed it by copying the whole private key including the comments and adding it to the secrets of the GitHub repo. So the copied key should include -----BEGIN PRIVATE KEY-----
and -----END PRIVATE KEY-----
.
Example:
-----BEGIN PRIVATE KEY-----
...... key ......
-----END PRIVATE KEY-----
@yarns123 Can you help to try https://github.com/appleboy/scp-action/releases/tag/v0.1.3 version?
Also, see the https://github.com/appleboy/scp-action#setting-up-a-ssh-key section.
For those having the same issue.
I ran into this and fixed it by copying the whole private key including the comments and adding it to the secrets of the GitHub repo. So the copied key should include
-----BEGIN PRIVATE KEY-----
and-----END PRIVATE KEY-----
.Example:
-----BEGIN PRIVATE KEY----- ...... key ...... -----END PRIVATE KEY-----
For anyone still getting the following error:
ssh.ParsePrivateKey: x509: failed to parse private key (use ParsePKCS1PrivateKey instead for this key format)
The copied key should have RSA in the beginning/end, if that is how it was generated.
Example:
-----BEGIN RSA PRIVATE KEY-----
...... key ......
-----END RSA PRIVATE KEY-----
I copied the entire .pem file, including
-----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
Still getting the same error. Need help
my deploy.yml file :
`name: CI/CD Pipeline
on: push: branches:
jobs: build: runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Deploy to EC2
if: success()
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_KEY }}
script: |
cd /home/ubuntu/{project-name}
git pull origin main
source venv/bin/activate
pip install -r requirements.txt
sudo systemctl restart gunicorn
sudo systemctl restart nginx
`
Im getting this error:
2021/11/12 09:59:53 ssh.ParsePrivateKey: ssh: no key found 2021/11/12 09:59:54 error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain drone-scp error: error copy file to dest: ***, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
And my code looks like:
- name: copy file via ssh key uses: appleboy/scp-action@v0.1.2 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} source: "${{ secrets.SOURCE}}" target: ${{ secrets.TARGET }}
Any tips how to fix it?