Issue adding new deploy key with octokit.rb

342 views Asked by At

I feel like I'm missing something glaringly obvious, but when calling .add_deploy_key I'm getting the following (user and repo below are placeholders):

Octokit::UnprocessableEntity:
POST https://api.github.com/repos///keys: 422 - Validation Failed Error summary: resource: PublicKey code: custom field: key message: key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key // See: http://developer.github.com/v3/repos/keys/#create

Here is an example of the generated key:

"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCluDMepWvk7Ur68mj0RVJ0W419FiiZdHgClBF7z56uK5LzMfc5H4K91EI2uvepNwMu8U0+mgFr4PKmxgnKa+eclQqpxpohX+aCMQ3tkbeuPZ7XF5y1yMahNXHZAXIhBSlbjbA/GmmkGHc+wA4n0ey1wR6rWwdMa/fQ5/H8P3sRKSgkvpx9BNBf95CZpewiwtCNDwhOak3+XbYJDcYGMh1nd2Jp4Fu3r6H7jff9Krz4Wsa1dpRBKBhvYDWhv8+l4AMG6ghUDiP5YDFF9IacSxp1OHTCOcRbDXWlq60NXJNvVpyWNP7xXPb0STcE5jZ1UK+0DkBV0ESWRJZLo18l54U9"

If I take this exact same key and paste it into the web UI, it accepts it just fine. I'm authenticated with an Oauth access token.

Any pointers?

1

There are 1 answers

0
Chris Ball On

This seems to somehow have been a temporary issue... the exact same code works fine today.