GitHub error "repository not found" using ssh
Yesterday (2021-07-21) I started having a problem with using git against some of my private github repositories. Trying to fetch updates would look like this:
$ git fetch upstream ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
It turns out this was caused by my using an old 2048-bit rsa key for SSH. Perhaps github are rolling this change out across all private repos. You can create a new 4096-byte key with the command:
$ ssh-keygen -b 4096 -t rsa -C "This is my new key" -f ~/.ssh/id_rsa_4k
(replace the comment and perhaps the key filename to suit).
You probably don't want to overwrite your old key in case you still need it for accessing other systems (although it would be wise to update them with your new key for safety). If you do use a different filename you might want to configure ssh to specifically use that key (and only that key) for github. You can do with with an entry like this in
host github.com IdentitiesOnly yes IdentityFile ~/.ssh/id_rsa_4k
(again, using whatever filename you used for the key).
Don't forget to upload the public key to github so that it recognises it!
It's worth noting that if you remove the old key from github you probably won't have to add the "IdentitiesOnly" flag, and if you replace your old key entirely you won't need to have a config entry at all.
Add new comment