-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "remove" feature to ssh-key #6136
Comments
Wrote some scripts in case other people need this functionality # get list of keys
gh_list_keys() {
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GH_TOKEN" \
https://api.github.com/user/keys
}
# get key ids by title
gh_key_by_title() {
list_keys | jq -r '.[] | "\(.id) \(.title)"'
# ^ combine with grep to filter the title you need
}
# delete ssh key
gh_key_del() {
local KEY_ID=$1
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token $GH_TOKEN" \
https://api.github.com/user/keys/$KEY_ID
}
|
I'm in favor of this assuming there isn't some big reason we didn't do it to begin with. |
I would like to pick this up but need to check my idea first. GitHub API provides a way to get/delete by key id. And key names are not unique. I can create two keys with the same name here:
My idea is
If this makes sense, I can open the PR for this. |
@nsmag That seems like a reasonable approach to me. The biggest concern is where we will add the cc/ @vilmibm For any input here. |
@samcoe I also concern about changing
But I think adding the header is a breaking change as well. |
@nsmag I would be open to also adding in a header. I don't view the header itself as a breaking change as we would not output it in non-tty mode, so from a scripts point of view nothing has changed. |
@samcoe If adding header or appending columns to the output is okay. Should we change the output of
To delete a key, use
If this approach is good to go, I plan to open two PRs:
|
@nsmag That sounds good to me 👍 |
@samcoe |
Describe the feature or problem you’d like to solve
I'd like to be able to remove ssh key from account from the command line. It's hard to believe there are no requests for this, so I must just be missing them, but is there no way to remove a key from the command line.
You can add with:
But there is no way to remove.
In the original request (#2990) there was a proposal to remove by hash, but you could also remove by title.
The text was updated successfully, but these errors were encountered: