webfactory / ssh-agent

GitHub Action to setup `ssh-agent` with a private key
MIT License
1.19k stars 247 forks source link

fata: repository 'github.com/owner/myrepo' does not exist #165

Open olvresc opened 1 year ago

olvresc commented 1 year ago

Hello, encountering an error when using webfactory/ssh-agent@v0.7.0

git clone github.com/olvresc/aaa
  shell: /usr/bin/bash -e {0}
  env:
    SSH_AUTH_SOCK: /tmp/ssh-XXXXXXNIEYzk/agent.1584
    SSH_AGENT_PID: 1585
fatal: repository 'github.com/olvresc/aaa' does not exist

Worflow

name: Deploy
    runs-on: ubuntu-22.04
    steps:
      - name: Setup SSH for private repository
        uses: webfactory/ssh-agent@v0.7.0
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
      - uses: actions/checkout@v3
      - name: Setup Node 16
        uses: actions/setup-node@v3
        with:
          node-version: 16
      - name: Clone test
        run: |
           git clone github.com/olvresc/aaa

Error:

image

image


Added my private key as SSH_PRIVATE_KEY and public key as deploy key with comment git@github.com:olvresc/aaa.git

mpdude commented 1 year ago

At first sight, configuration looks ok.

Could you try git clone git@github.com:olvresc/aaa.git as the URL please?

olvresc commented 1 year ago

At first sight, configuration looks ok.

Could you try git clone git@github.com:olvresc/aaa.git as the URL please?

Hi, was able to clone the repository (on my machine)

$ git clone git@github.com:olvresc/aaa.git
Cloning into 'aaa'...
remote: Enumerating objects: 351, done.
remote: Counting objects: 100% (351/351), done.
remote: Compressing objects: 100% (254/254), done.
remote: Total 351 (delta 171), reused 268 (delta 88), pack-reused 0 eceiving objects:  59% (208/351)
Receiving objects: 100% (351/351), 91.40 KiB | 207.00 KiB/s, done.
Resolving deltas: 100% (171/171), done.
OscarVanL commented 1 year ago

I have the same issue.

I am using this action to use a deploy key to pull a private submodule.

When I use this action:

      - uses: webfactory/ssh-agent@v0.8.0
         with:
           ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY}}
      - uses: actions/checkout@v3
         with:
           submodules: true

I get the following output from my checkout step:

Fetching submodules
  /usr/bin/git submodule sync
  /usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1
  Submodule 'bar' (git@github.com:foo/bar.git) registered for path 'src/bar'
  Cloning into '/opt/actions-runner/_work/baz/baz/src/bar'...
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/foo/bar.git/' not found
  Error: fatal: clone of 'git@github.com:foo/bar.git' into submodule path '/opt/actions-runner/_work/baz/baz/src/bar' failed
  Failed to clone 'src/baz'. Retry scheduled
  Cloning into '/opt/actions-runner/_work/baz/baz/src/bar'...
  remote: Repository not found.
  Error: fatal: repository 'https://github.com/foo/bar.git/' not found
  Error: fatal: clone of 'git@github.com:foo/bar.git' into submodule path '/opt/actions-runner/_work/baz/baz/src/bar' failed
  Failed to clone 'src/bar' a second time, aborting
  Error: The process '/usr/bin/git' failed with exit code 1

However when I use a fork of this project that has been extended to add repo-mappings, it works without any further alterations:

      - uses: shaunco/ssh-agent@git-repo-mapping
         with:
           ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}
           repo-mappings: github.com/foo/bar
      - uses: actions/checkout@v3
         with:
           submodules: true

This makes me believe that there is nothing wrong with my SSH deploy key and instead there is a bug in this project.

I read the main README and it sounds like I should not experience any issues as this is the only SSH private key I install, and I only pull one submodule.

OscarVanL commented 8 months ago

Nevermind, I spoke to soon. After merging and the CI running a few more times the issue still happens, it just appears to not happen all the time.

~This problem no longer happens for me with the latest ssh-agent.~

~The only thing that has changed is that I'm now using actions/checkout@v4 instead of v3:~

      - uses: actions/checkout@v4
        with:
          submodules: true

~My config now looks like:~

      - uses: webfactory/ssh-agent@v0.8.0
         with:
           ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}
           repo-mappings: github.com/foo/bar
      - uses: actions/checkout@v4
         with:
           submodules: true