I want to automatically add public key from newly created machine to github account (so it could checkout organization projects). Is there any simple way to do that? Machine OS is Debian Wheezy.


Its not a pretty answer and requires some leg work, to automate it, you would have to implement their API. Otherwise your best option is to generate the keys and add them via the webui.

GitHub API Reference: https://developer.github.com/v3/users/keys/

curl -d '{"title": "user@machinename","key": "ssh-rsa AAA..."}' https://api.github.com/user/keys?client_id=xxxx&client_secret=yyyy

This is a rough idea, and requires using OAUTH key/secret which github normally recommends against, you'd have to generate your SSH keys before you run this, adn you have to replace the contents of the key parameter, with your actual SSH public key (including ssh-rsa/ssh-dsa). Not sure if DSA even works with GitHub.

You can see more information about the GitHub API here: https://developer.github.com/v3/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.