The company I work with and I are both using Gitlab as remote repo. To make it simple from my personal laptop I want to be able to connect on 2 distinct repo. The company's one and mine. I'm using 2 accounts to achieve this purpose (personal and company)
Locally
I've configured 2 stanzas/sections into my ~/.ssh/config
Host gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/personal
ForwardAgent yes
Host company.gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/company
ForwardAgent yes
When I'm doing git operation from my local computer all is good.
The problems appear when I connect to my personal remote server and I try to git my repo. And I receive error like
remote:
remote: ========================================================================
remote:
remote: The project you were looking for could not be found.
remote:
remote: ========================================================================
remote:
fatal: Could not read from remote repository.
After some search it appears, git is using the bad identity.
If I'm doing ssh-add -l I get 2 fingerprints
4096 SHA256:xxxxxxxxxx personal_key (RSA)
4096 SHA256:yyyyyyyyyy company_key (RSA)
How to be sure only one identity is used from MY remote server on MY git repo ? How to be sure I'm using the right identity from my personal remote server (the personal_key) ?
Thanks for your help.