ssh-agent icon indicating copy to clipboard operation
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

Open viral1701 opened this issue 1 year ago • 8 comments

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 }}

viral1701 avatar Feb 23 '24 10:02 viral1701

Have the same, did you find a solution?

eriweb avatar Mar 07 '24 14:03 eriweb

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

dhuseby avatar Apr 28 '24 02:04 dhuseby

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. image

vaherdiana avatar May 02 '24 04:05 vaherdiana

@vaherdiana Thanks a lot for the analysis! Would you be able to open a PR?

sebastiankugler avatar May 02 '24 07:05 sebastiankugler

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 avatar May 02 '24 09:05 vaherdiana

@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.

Bildschirmfoto 2024-05-02 um 11 56 46

So I don't think that this is the cause of the problem.

sebastiankugler avatar May 02 '24 09:05 sebastiankugler

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

ELHart05 avatar Aug 15 '24 05:08 ELHart05

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 :/

sbates avatar Aug 20 '24 21:08 sbates