简体   繁体   中英

Remove ssh keys in github from command line

I'm creating a script in bash to install and configure all my workspace. How do I remove my ssh keys in github from command line?

I already search about and found this command, but this is specifically for deploy and not remove.

curl -u 'user:password' --data '{"title":"My SSH","key":"'"$(cat ~/.ssh/id_rsa.pub)"'"}' https://api.github.com/user/keys

The code above works perfectly but how do I remove (if exists) instead of deploy?

you can use following request to get the list of installed keys:

curl -u 'user:password' https://api.github.com/user/keys

And delete specific key by specifying its ID:

curl -u 'user:password' -X DELETE https://api.github.com/user/keys/:key_id

you can find documentation here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM