I've added GitHub Deploy key manually. Now I would likt to import it to my state. But when I look into github_repository_deploy_key resource docs I can read

"Repository deploy keys can be imported using a colon-separated pair of repository name and GitHub's key id. The latter can be obtained by GitHub's SDKs and API."

$ terraform import github_repository_deploy_key.foo test-repo:23824728

I was looking for this GitHub's key id for a long time but without a luck. If I go to https://github.com/\/<REPO>/settings/keys I cannot see any ID (numerical) in my key information.

I've try to use SHA256: bit from deploy key information, but it end's up with the following error:

Error: Unexpected ID format ("ddf62fc..."), expected numerical ID. strconv.ParseInt: parsing "ddf62fc...": invalid syntax

How can I find my GitHub's (deploy) key ID?

1 Answer 1


OK, I found it..

gh api https://api.github.com/repos/<OWNER>/<REPO>/keys | jq .[].id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.