I have used my office github account. But i was need to add my personal github account also. My office github account is dinukafrost
. My personal github account is dinuka
.
I did following steps.
- Create ssh keys. (I have already had ssh key for office account)
- Add public keys to github. (My office public key was added)
- Create ~/.ssh/config file.
My ssh keys.
id_ed25519_dinuka
id_ed25519_dinukafrost
id_ed25519_dinukafrost.pub
id_ed25519_dinuka.pub
My config file
PubkeyAcceptedKeyTypes=+ssh-rsa
# dinukafrost
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519_dinukafrost
# dinuka
Host dinuka github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519_dinuka
These command are given correct response.
➜ ssh -T [email protected]
Hi dinuka! You've successfully authenticated, but GitHub does not provide shell access.
➜ ssh -T git@dinuka
Hi dinuka! You've successfully authenticated, but GitHub does not provide shell access.
Now i can use my personal account with dinuka
host. eg - origin git@dinuka:dinuka/laravel_test.gi
But i can't use my office repos that i was using. eg - origin [email protected]:MyCompany/lp-service-registry.git
It is throwing following error
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
How can i fix this issue. Is any way to find any logs for fixing this?
That means a
github.com
entry authenticates you with your personal account.Probably because of the entry
Host dinuka github.com
, instead ofHost dinuka
I prefer using entries with a specific name rather than "github.com".
(And I always include
User git
, to avoid thegit@
part of the SSH URL).Check if
ssh -Tv github.com
does authenticate you asdinukafrost
.If not, replace
Host github.com
withHost dinukafrost
, and repeat the test withssh -Tv dinukafrost
.