Gitlab SSH Config Host File, Allowing Multiple Account SSH Access

Photo by Pankaj Patel on Unsplash

Pre-requisties:

  • Assuming that you are using a Linux or a macOS system with an OpenSSH client installed. — All modern macOS operating systems and linux distributions come with SSH pre-installed.
  • Gitlab Account.

The Error

#Work GitLab Account
Host gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
#Personal Gitlab Account
Host gitlab.com-personal-key
HostName gitlab.com
IdentityFile ~/.ssh/personal-key
IdentitiesOnly yes
ssh-keygen -t rsa -b 4096
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/personal-key
git clone git@gitlab.com-personal-key:[enter your user account name here]/medium-test-personal-repo.git
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/new-account#New Gitlab Account
Host gitlab.com-new-account
HostName gitlab.com
IdentityFile ~/.ssh/new-account
IdentitiesOnly yes

--

--

--

DevOps, AWS Certified SysOps Cloud Engineer & Tech Writer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

LIMITATIONS OF DAO PROJECTS & SOLUTIONS FOR INVESTORS

OSD600 —Week 4

Software Interviews Suck — Here is How to Fix Them

5 Things to Know About Service Mesh Performance

CI/CD Superhero: Feature Flags

philosoraptor meme, a green velociraptor with its claw up to its chin to signify that it is thinking

HackTheBox-BountyHunter

Portswigger SQLi-Lab 9

HTML and CSS as a first step

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Daryl

Daryl

DevOps, AWS Certified SysOps Cloud Engineer & Tech Writer

More from Medium

Backup your database using cron

How to configure Passbolt with Postgresql (experimental)

Getting git to work in a Windows docker container

How To Setup Nginx Reverse Proxy Server On Ubuntu 20.04