Closed
Description
Description
Hi there,
Im trying to SSH via basic commands to my SSH server.
- I added the correct pub key into my Server
- I added 3 secrets in my Gitea Installation
SSH_USER
SSH_KEY
SSH_HOST
where SSH_KEY is the actual private key
And I'm using the following action.yaml
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions
on: [push]
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
cat >>~/.ssh/config <<END
Host staging
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
cat ~/.ssh/config
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
- name: Test SSH
run: ssh staging 'ls'
After some debugging it seems that the Secrets field is removing the last new line of the Private Key. In my case I can fix it by using echo "${{ secrets.SSH_KEY }}" | tr -d '\r' > ~/.ssh/staging.key
instead.
However, the secret field should not trim the content. It should respect the last new line of the file.
Gitea Version
1.19.3
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
Git Version
No response
Operating System
No response
How are you running Gitea?
Gitea is running in a docker container.
Database
SQLite