Skip to content

Instantly share code, notes, and snippets.

@yuikns
Last active August 29, 2015 14:05
Show Gist options
  • Save yuikns/e74770250d73f6c9c1fe to your computer and use it in GitHub Desktop.
Save yuikns/e74770250d73f6c9c1fe to your computer and use it in GitHub Desktop.
#!/bin/sh
# this bash is base on https://developer.github.com/v3/users/keys/#create-a-public-key
username='yourname'
password='yourpassword'
id_to_delete='123'
curl -X DELETE https://api.github.com/user/keys/$id_to_delete -u "$username:$password"
#!/bin/sh
# this bash is base on https://developer.github.com/v3/users/keys/#create-a-public-key
username='yourname'
password='yourpassword'
id_rsa_title='upload_title'
id_rsa_pub_path='~/.ssh/id_rsa.pub'
data_to_post="{\"title\":\"$id_rsa_title\",\"key\":\"`cat $id_rsa_pub_path`\"}"
curl --data "$data_to_post" https://api.github.com/user/keys -u "$username:$password"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment