Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ernanej/multiplas-sshkeys
Quick guide to generating and managing multiple SSH Keys for github and Gitlab.
https://github.com/ernanej/multiplas-sshkeys
github-config gitlab ssh-git ssh-key
Last synced: 15 days ago
JSON representation
Quick guide to generating and managing multiple SSH Keys for github and Gitlab.
- Host: GitHub
- URL: https://github.com/ernanej/multiplas-sshkeys
- Owner: ErnaneJ
- Created: 2021-05-28T13:30:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-12T14:59:12.000Z (over 3 years ago)
- Last Synced: 2024-10-24T21:59:04.054Z (2 months ago)
- Topics: github-config, gitlab, ssh-git, ssh-key
- Homepage:
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Múltiplas chaves SSH para GitHub e GitLab
## 1. Gerar Chaves SSH
``` bash
ssh-keygen -t rsa -C "[email protected]" -b 4096 -f ~/.ssh/id_rsa_github
ssh-keygen -t rsa -C "[email protected]" -b 4096 -f ~/.ssh/id_rsa_gitlab
```## 2. Copiar chaves para GitHub e GitLab
``` bash
# Copiar chave pública para o GitHub
cat < ~/.ssh/id_rsa_github.pub
# Em seguida colar no painel do GitHub# Copiar chave pública para o GitLab
cat < ~/.ssh/id_rsa_gitlab.pub
# Em seguida colar no painel do GitLab
```## 3. Adicionar as chaves ao SSH-Agent
``` bash
ssh-add ~/.ssh/id_rsa_github
ssh-add ~/.ssh/id_rsa_gitlab
```## 4. Arquivo de configuração
``` bash
touch ~/.ssh/config
nano ~/.ssh/config
```**Arquivo** `config`
```
# Conta do GitHub
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github# Conta do GitLab
Host gitlab.com
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitlab
```## 5. Testando as conexões
``` bash
ssh -T [email protected]
yes
# Hi UserName! You've successfully authenticated, but GitHub does not provide shell access.ssh -T [email protected]
yes
# Welcome to GitLab, @UserName!
```