checkout icon indicating copy to clipboard operation
checkout copied to clipboard

Checkout another private repo from the same Organization does not work on enterprise server

Open johanneszellinger opened this issue 1 year ago • 6 comments

I have two repos A and B in the same organization on our self-hosted Github enterprise instance. Repo B is a dependency for the code in repo A, so I want to create a workflow in repo A, where both repos are checked out.

Here is the workflow I tried so far:

  • create a SSH-key with git-bash:
    1. ssh-keygen -t ed25519 -C "[email protected]"
    2. no passphrase
    3. This creates two files one .pub for the public key and one for the private key
  • In Repo B go to Settings->deploy keys->add deploy key and copy the contents of the public key as the value- In Repo A go to Settings->Secrets and variables->Actions->New Repository Secret and copy the content of the private key as value
  • Test the following workflow yaml
  name: My Workflow
  
  on:
    workflow_dispatch:
  
  jobs:
    build-and-push-image:
      name: test
      runs-on: [ self-hosted, fast]
  
      steps:
        - name: Check out repo A
          uses: actions/checkout@v3
          with:
            path: path_to_A
  
        - name: Check out repo A
          uses: actions/checkout@v3
          with:
            repository: myorg/b
            path: path_to_B
            ssh-key: ${{ secrets.PRIVATE_KEY_B }}
  
        - name: debug # just to debug
          run: find .

Unfortunately this does not work and I get the following errors:

No ECDSA host key is known for github.company.com and you have requested strict checking. Host key verification failed. Error: fatal: Could not read from remote repository.

I am not sure what the issue is here. I have also already tried to set the private key for the ssh agent as described here, but also without success. Any pointers would be much appreciated! The error only appears while checking out repo B. Checkout for repo A works flawlessly. I am actually not sure, why there should be different access rights between the two repos.

johanneszellinger avatar Jun 12 '23 13:06 johanneszellinger