The script here effectively wraps up the documentation for generating SSH keys for GithHub. At the moment this is entirely untested and therefore likely has a lot of wrinkles which will be smoothed out (it was created on a system that doesn't need it for the sake of other systems).


declare -r email="${1?Provide email address as first argument}"
declare -r output_file="${2?Provide key file as second argument}"
declare -r title="${3?Provide title as third argument}"

declare -r gh="${GH:-gh}"

my::die() {
	echo "${@}"
	exit 1
} >&2

type -t ${gh} > /dev/null || my::die 'gh GitHub client is not installed, install using brew?'
${gh} auth status || my::die 'Login with GitHub Client!'

ssh-keygen -t ed25519 -C "${email}" -f "${output_file}"
${gh} ssh-key add "${output_file}.pub" --type authentication --title "${title}"

Note aboute auth... Example in ~/.ssh/config

        User git
        IdentityFile ~/.ssh/id_mw

Reboot ssh-agent