webfactory / ssh-agent

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

Deploy key not "treated as deploy key" #73

Closed rr-james-hickman closed 3 years ago

rr-james-hickman commented 3 years ago

I have followed the guide to setup a deploy key on a private git repo for a Swift Package.

I generated new SSH in the private SP repo using this command: ssh-keygen -b 4096 -t rsa -N "" -f key -C "git@github.com:my-org/my-swift-package-repo.git" I have added the .ssh/key files (private/public) and the config file with GitHub.com host to the private SP repo. I have added the public key as a deploy key on the private SP repo. I have added the private key as a secret on the other repo that has an app using the SP as a dependency.

No matter what, I get this error:

Comment for key '' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

xcodebuild: error: Could not resolve package dependencies:
10
  The remote repository could not be accessed. Make sure a valid repository exists at the specified location and that the correct credentials have been supplied.

Here is my yaml:

      - name: Set SSH Key for remote host
        uses: webfactory/ssh-agent@v0.5.2
        with:
          ssh-private-key: ${{ secrets.SPM_SSH_PUBLIC_KEY }}

Any help would be greatly appreciated!

mpdude commented 3 years ago

@cerupcat has issues with Swift as well. I don’t know anything specific about Swift, but maybe you two could team up and see if the initial pointers I gave at #72 lead to a solution?

mpdude commented 3 years ago

Oh, and there must be a glitch since we seem to log the message for empty lines... PRs welcome to fix that!

rr-james-hickman commented 3 years ago

Thanks @mpdude ! I was able to resolve my problem with:

  1. Help from #72
  2. This SO post: https://stackoverflow.com/questions/47842479/how-to-use-swift-package-manager-with-private-repos
  3. And adding -scmProvider system to my xcodebuild command

🎉

mpdude commented 3 years ago

@rr-james-hickman If you have an idea how the README could be improved to explain this for other Swift users, it would be great if you could open a PR!

rr-james-hickman commented 3 years ago

@mpdude Done: #74 Feel free to update/format to your preferred liking.