Skip to content

Instantly share code, notes, and snippets.

@koara-local
Created October 14, 2016 09:03
Show Gist options
  • Select an option

  • Save koara-local/a3f8506f7215f29dca78c997e043881d to your computer and use it in GitHub Desktop.

Select an option

Save koara-local/a3f8506f7215f29dca78c997e043881d to your computer and use it in GitHub Desktop.
#!/bin/bash -eu
if [ ! -e ~/.ssh/id_rsa_gitlab ]; then
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa_gitlab
fi
if [ ! -e ~/.ssh/config ] || [ $(cat ~/.ssh/config | grep github | wc -l) == 0 ]; then
cat << EOS >> ~/.ssh/config
Host github github.com
User git
Hostname github.com
Port 22
IdentityFile ~/.ssh/id_rsa_github
EOS
fi
echo -e "please, Adding a new SSH key to your GitHub account\n"
cat ~/.ssh/id_rsa_gitlab.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment