Skip to content

Is it possible to force actions/checkout to use SSH rather than HTTPS? #50130

Closed Answered by Anmol-Baranwal
zaikunzhang asked this question in Actions
Discussion options

You must be logged in to vote

Yes, it is possible to force actions/checkout to use SSH rather than HTTPS. You can specify the ssh-key input parameter to actions/checkout, which will use the specified private key for authentication with GitHub. Here's an example of how to use it:

e.g. a sample code

- name: Checkout code
  uses: actions/checkout@v2
  with:
    repository: my-org/my-repo
    ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}

There doesn't seem to be anything inherently wrong with this workflow, but here are a few observations:

  1. The pull_request trigger is commented out with a warning that it must be disabled for self-hosted runners. It's good to see that you are aware of the potential dangers of running untrusted…

Replies: 5 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by zaikunzhang
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@zaikunzhang
Comment options

@airtower-luna
Comment options

@zaikunzhang
Comment options

@Anmol-Baranwal
Comment options

@Anmol-Baranwal
Comment options

Comment options

You must be logged in to vote
2 replies
@zaikunzhang
Comment options

@metaclips
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
5 participants