ssh-agent
ssh-agent copied to clipboard
Error: does not match GitHub URL pattern. Not treating it as a GitHub deploy key on version 0.9.0
Receiving error does not match the GitHub URL pattern. I am not treating it as a GitHub deploy key on v0.9.0. Using an
action.yml`, there is not much going on the steps; however, it keeps failing to download the repo.
I am only downloading a single key. Below is my action.yml setup
- name: Checkout Working Directory
uses: actions/checkout@v4
- name: Set up SSH agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ inputs.SSH_PRIVATE_KEY }}
Have the same, did you find a solution?
Did you generate your key with a comment that matches the other repo's url? https://github.com/webfactory/ssh-agent#support-for-github-deploy-keys
I think the problem is here: if you adjust the regex checking for the comment of public RSA key, adding escape there, it would recognise better.
@vaherdiana Thanks a lot for the analysis! Would you be able to open a PR?
No I would not dare yet, I am trying to figure out how it works myself. Created a copy of the repo, but getting permission issues, so cant really test and I don't want to propose anything without testing. WIP :) I estimate there should be 2 groups in that regex though...
@vaherdiana I just tested the regex myself in regex101.com. If you switch to "ECMAScript (Javascript)" you see that the /
does not need to be escaped in JS.
So I don't think that this is the cause of the problem.
After some research I used another package called appleboy/ssh-action and worked fine!
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Deploy using ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
cd /var/www/youtube.com/
git pull origin main
git status
npm install --only=prod
This regex also assumes that you are using Github.com which keeps me from being able to use this when I sync from one org to a private enterprise version :/