ssh-keygen -t ed25519 -C "username@domain"
username@domain
can be your email or the username
@ server domain
for easier readability, or anything.
Store it using a custom filename like ~/.ssh/github-REPO
In your repository settings (https://github.com/USER/REPO/settings/keys), add a new key with the content from the public key (~/.ssh/github-REPO.pub
)
Edit ~/.ssh/config
and add an entry like this:
Host github-REPO
User git
Hostname github.com
IdentityFile /home/USRE/.ssh/github-REPO
Where the Host
is what it's going to be used as the git origin URL, and the IdentityFile
is the path for the key generated in the step 2
Go to the REPO folder and set it using
git remote set-url origin git@github-REPO:USER:REPO.git
It should work and each repo should be able to use its own ssh key to identify with github.