Skip to content

Instantly share code, notes, and snippets.

@0x77dev
Last active May 18, 2021 11:01
Show Gist options
  • Save 0x77dev/dcc98990a309874bc249115969575e60 to your computer and use it in GitHub Desktop.
Save 0x77dev/dcc98990a309874bc249115969575e60 to your computer and use it in GitHub Desktop.
Install SSH keys from GitHub

Install SSH keys from GitHub

This script installs your public ssh keys from GitHub to your ~/.ssh/authorized_keys.

Example

$ curl -L https://git.io/JTZHT | bash -s 0x77dev

Usage

$ curl -L https://git.io/JTZHT | bash -s <username>
#!/bin/bash
[ ! -d "~/.ssh" ] && mkdir ~/.ssh
[ ! -d "~/.ssh/authorized_keys" ] && touch ~/.ssh/authorized_keys
curl https://api.github.com/users/$1/keys | jq ".[].key" | sed 's/\"//g' | sed 's/\ssh-rsa //g' >> ~/.ssh/authorized_keys
#!/bin/bash
curl -L https://git.io/JTZHT | bash -s 0x77dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment