Last active
December 20, 2024 00:13
-
-
Save JoKenPo/40b49c94da7234238e2c84ed70f8b8cf to your computer and use it in GitHub Desktop.
Revisions
-
JoKenPo revised this gist
Dec 20, 2024 . 1 changed file with 12 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,20 @@ ## Usar chaves SSH para múltiplas contas Se você está usando SSH para autenticação, pode configurar chaves separadas para GitLab e GitHub. Crie uma nova chave SSH para cada conta: `bash ssh-keygen -t rsa -b 4096 -C "[email protected]" ` Slve o arquivo com um nome diferente, como id_rsa_github. Adicione a chave ao SSH-Agent: `bash ssh-add ~/.ssh/id_rsa_github ` Configure o arquivo ~/.ssh/config: Adicione entradas separadas para cada conta: `plaintext Host gitlab.com HostName gitlab.com User git @@ -26,15 +24,16 @@ Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa_github ` Adicione a chave SSH na sua conta do GitHub: Copie a chave pública gerada: `bash cat ~/.ssh/id_rsa_github.pub ` Vá para as configurações de SSH no GitHub e cole a chave. Teste a conexão: `bash ssh -T [email protected] ` -
JoKenPo created this gist
Dec 20, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ Usar chaves SSH para múltiplas contas Se você está usando SSH para autenticação, pode configurar chaves separadas para GitLab e GitHub. Crie uma nova chave SSH para cada conta: bash Copiar código ssh-keygen -t rsa -b 4096 -C "[email protected]" Salve o arquivo com um nome diferente, como id_rsa_github. Adicione a chave ao SSH-Agent: bash Copiar código ssh-add ~/.ssh/id_rsa_github Configure o arquivo ~/.ssh/config: Adicione entradas separadas para cada conta: plaintext Copiar código Host gitlab.com HostName gitlab.com User git IdentityFile ~/.ssh/id_rsa_gitlab Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa_github Adicione a chave SSH na sua conta do GitHub: Copie a chave pública gerada: bash Copiar código cat ~/.ssh/id_rsa_github.pub Vá para as configurações de SSH no GitHub e cole a chave. Teste a conexão: bash Copiar código ssh -T [email protected]