3 ms·
You don’t need tools for this, run this command once and you’ll never have to worry about using the wrong key for that git repo again: cd <git repo> gi
by CraigJPerry 3y ago
You don’t need tools for this, run this command once and you’ll never have to worry about using the wrong key for that git repo again:
cd <git repo>
git config --local core.sshCommand "ssh -i ~/.ssh/id_<private key to use>"
Job done.
- pinhead 3y agoUsing `git config` is great. Another option since I don't always remember that command is `export GIT_SSH_COMMAND="ssh -i <private-key>"` https://git-scm.com/docs/git#Documentation/git.txt-codeGITSSHCOMMANDcode https://git-scm.com/docs/git#Documentation/git.txt-codeGITSS...
- ozim 3y agoEven better, you can set identity as email or commit creator per repo and use private key per machine. Instead of making multiple private keys and god forbid copy these over to other machines.