Skip to content

Instantly share code, notes, and snippets.

@alejandrobernardis
Last active June 3, 2021 23:24
Show Gist options
  • Save alejandrobernardis/e27ab326b968570cc003ca29cbe8a3b8 to your computer and use it in GitHub Desktop.
Save alejandrobernardis/e27ab326b968570cc003ca29cbe8a3b8 to your computer and use it in GitHub Desktop.
SSH Config

SSH Config

# directorio de trabajo
mkdir -p ~/.ssh/config.d/ssh
# configuración principal
touch ~/.ssh/config
# configuración empresa
touch ~/.ssh/config.d/company.conf

Template para el archivo ~/.ssh/config.d/company.conf

Host github.com-%COMPANY-NAME%
  HostName github.com
  AddKeysToAgent yes
  PreferredAuthentications publickey
  # ubicación de la clave privada de la empresa
  IdentityFile ~/.ssh/config.d/ssh/id_rsa_%COMPANY-NAME%
  IdentitiesOnly yes
  User git

Clonar un repositorio de la empresa:

git clone git@github.com-%COMPANY-NAME%:<USERNAME>/<REPO>.git

Reemplazar el valor %COMPANY-NAME% por el nombre de la empresa.

# Path: ~/.ssh/config.d/company.conf
Host github.com-company
HostName github.com
AddKeysToAgent yes
PreferredAuthentications publickey
# ubicación de la clave privada de la empresa
IdentityFile ~/.ssh/config.d/ssh/id_rsa_company
IdentitiesOnly yes
User git
# Path: ~/.ssh/config
# global
Host *
KeepAlive yes
IdentitiesOnly yes
ServerAliveInterval 60
ServerAliveCountMax 20
ForwardAgent yes
# github
Host github.com
HostName github.com
AddKeysToAgent yes
PreferredAuthentications publickey
# ubicación de la clave privada primaria
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
User git
# include
Include ~/.ssh/config.d/*.conf
# clave personal
git clone git@github.com:<USERNAME>/<REPO>.git
# clave empresa
git clone git@github.com-company:<USERNAME>/<REPO>.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment