Skip to content

Instantly share code, notes, and snippets.

@nenitf
Last active Oct 14, 2019
Embed
What would you like to do?

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