Two or more ssh-keys to github accounts – mac os how to solve 'Repository not found' issue

Hello faces… (czyli cześć mordy)! Long time no see. its been more than a year! Last post since 30.04.2018! OMG I’ll not lie, that I was busy… I was just lazy to put anything here… instead of  writing was have been watching tv, hanging around and doing other stuff, but not writing – today is 02.06.2019!!! Its like 13 month of nothing – big gap – but now it will change… or you can say I’ve some more energy to write my blog again. So today on Sunday… and really today is sunny day so instead of doing some activity I’m sitting here and writing blog post, btw today is also penultimate (przedostatni) day of Ramadan… Monday and Eid…  and always after Ramadan there is sunna to fast for 6 days… but never did this, 4… maybe 3  days.. but and than it goes away… ok enough with the introduction…  lets solve real life problems…

Today I finally found time to solve problem why on mac Im getting:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

while trying to clone private git repository from my own account (by default Im using working ssh-key). Im using ssh_config for multiple accounts, but on mac it does not work (at least for me). I have :

Host github.com-rafath
  HostName github.com
  User git 
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa_rafath

Host github.com
  HostName github.com
  User git 
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa_company

According to what ssh-key file was loaded firstly I’ve got access or not (by default to mine own repository), first loaded key in ssh-add was blocking another one, and I was still getting the 404 error. It looks like it wasn’t taking IdentifyFile for exact host, so, I found solution to remove all keys from ssh-add (by ssh-add -D) and than add to .ssh/config this:

Host *
  UseKeychain yes 
  AddKeysToAgent no

on the top of file. Im sure about AddKeysToAgent that works and after using any host – it does not add keys to ssh-add, so it does work 😉

 

 

Rafath Khan

Tu powinien być pean na moją cześć, jaki to wspaniały jestem i jakimi niezwykłymi problemami się zajmuję, ale prawda jest taka, że jak każdy człowiek - mam swoje wady i może jakieś zalety. Są momenty, kiedy mam odpowiednią ilość zasobów psychoenergetycznych i mogę przenosić góry, a są niestety i takie momenty, kiedy mi się nawet z łóżka wstać nie chce... nie może tak źle nie jest, ale chętnie bym sobie pospał dłużej... Niemniej jednak, gdy uda się pokonać siebie - satysfakcja jest, ale potem przychodzą kolejne rzeczy, z którymi trzeba się zmierzyć... a na nie, niestety, energii może nie starczyć i tu właśnie wkracza tzw samodyscyplina - powinieneś usiąść i zrobić to coś, a nie siedzieć na kanapie i zajadać się słodyczami i oglądać jakiś nieciekawy serial czy film dla spalenia swojej najważniejszej waluty świata... czasu, którego nie da się odzyskać. I właśnie o tej samodyscyplinie traktować będę na tym blogu + kilka innych tematów, które są mi potrzebne do pracy

Może Ci się również spodoba