Git Repo Specific Keys
by
Jikku Jose
in
jikkujose.in

Multiple git identities can be managed by configuring specific identities within the repos itself:

git config --local user.name "John Doe"
git config --local user.email "john@doe.com"
git config --local core.sshCommand "ssh -i ~/custom/location/id_rsa"

This will be stored in the repo’s git config file .git/config:

[user]
        name = John Doe
        email = john@doe.com

[core]
        sshCommand = "ssh -i ~/custom/location/id_rsa"

Git clone one liner

git clone -c "core.sshCommand=ssh -i <key_path>" git@github.com:<user>/<repo>.git

Non interactive ssh-keygen

ssh-keygen -t ed25519 -f ~/.ssh/abc -q -C '' -N ''