Last active
August 22, 2023 23:12
-
-
Save ritiek/b92abd2c26ec30bff14b43ce673fb6c2 to your computer and use it in GitHub Desktop.
Change git identity for current repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate SSH keys for Bob and add them to ssh-agent | |
# Write it to `~/.ssh/bob.id_rsa`. | |
ssh-keygen -t ed25519 | |
ssh-add ~/.ssh/bob.id_rsa | |
git config --local user.name Bob | |
git config --local user.email "[email protected]" | |
git config --local credential.username bobxyz | |
git config --replace-all --local core.sshCommand "ssh -i ~/.ssh/bob.id_rsa" | |
# Bonus: signing commits using bob's SSH key generated above | |
git config --local gpg.format ssh | |
git config --local commit.gpgSign true | |
git config --local tag.gpgSign true | |
echo "[email protected] $(cat ~/.ssh/bob.id_rsa.pub)" > ~/.ssh/bob.allowed_signers | |
git config --local gpg.ssh.allowedSignersFile ~/.ssh/bob.allowed_signers | |
git config --local --replace-all user.signingKey "key::$(cat ~/.ssh/bob.id_rsa.pub)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment