Skip to content

Instantly share code, notes, and snippets.

@neninja
Last active October 14, 2019 17:00
Show Gist options
  • Save neninja/433e85b49acc802479654c75535eea2c to your computer and use it in GitHub Desktop.
Save neninja/433e85b49acc802479654c75535eea2c to your computer and use it in GitHub Desktop.

Como configurar SSH no github.

# Instalar gerador de ssh
sudo apt install openssh-client

# Gerar chave
ssh-keygen -t rsa -C "my@email.com"
# Pode dar enter em todas opções

# Ver chave pública e colocar no github
cat $HOME/.ssh/id_rsa.pub

# Permitir uso da ssh pelo github
ssh -T git@github.com
# Responder yes se questionado

Créditos aos Leandro Ramos


Caso existam multiplas keys o ideal é configurar no arguivo ~/.ssh/config. Exemplo de uma configuração abaixo:

Host github.com-oab
  Hostname ssh.github.com
  Port 443
  User git
  IdentityFile ~/.ssh/id_rsa
 
Host github.com
  Hostname ssh.github.com
  Port 443
  User git
  IdentityFile ~/.ssh/id_rsa_nenitf
  
 Host gitlab.com
  Hostname altssh.gitlab.com
  Port 443
  User git
  IdentityFile ~/.ssh/id_rsa-gitlab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment