Attempt at using the API to Create a Deployment Key for my Repository:
So I tried the following in my github account using the Create a deploy key documentation to select the permissions.
The docs read the following:
Fine-grained access tokens for “Create a deploy key”
This endpoint works with the following fine-grained token types:The fine-grained token must have the following permission set:
- ...
- Fine-grained personal access tokens
- "Administration" repository permissions (write)
So I did the following in my github account to set this up:
- Clicked my profile picture
- Clicked
Settings
- Clicked
Developer Settings
in the right sidebar - Expanded
Personal Access Tokens
in the right sidebar - Clicked
Fine-grained tokens
- Clicked
Generate New Token
Next, I was presented with the form to create a Fine-grained token where I used the following settings:
- Token name: jobsearch_dotfiles - Create a Deploy Key
- Repository Access - leeand00/jobsearch_dotfiles
- Permissions
- Repository Permissions
- Administration → Access Read and Write
- Repository Permissions
Next, I clicked the Generate token
button.
A dialog box appeared which read
New personal Access Token
Your new personal access token jobsearch_dotfiles - Create a Deploy Key will be ready immediately It will expire Wednesday, April 23, 2025.
jobsearch_dotfiles - Create a Deploy Key grants you 2 permissions for 1 repository:
Administration - Read and write
Metadata - Read-only
I then copied the personal access token tried the API call:
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer github_pat_..." -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/leeand00/jobsearch_dotfiles/keys -d '{"title":"leeand00@leeand00","key":"ssh-ed25519../xb..A vagrant@vagrant","read_only":true}'
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest",
"status": "404"
}
Still doesn’t work; any ideas what I’m doing wrong?