Setting up personal git keys
(Replace with your name and email)
1 Generate new personal SSH keys
- Run this:
cd ~/.ssh/; ssh-keygen -t rsa -b 4096 -C "[email protected]" -f "id_rsa_personal"
2 Add personal SSH keys
- Copy
~/.ssh/id_rsa_personal.pub
into your Gitlab keys. - Ubuntu: Set SSH keys perms:
chmod 0600 ~/.ssh/id_rsa*
- Windows only:
eval $(ssh-agent)
- Run these:
ssh-add ~/.ssh/id_rsa_personal touch ~/.ssh/config gedit ~/.ssh/config
- Paste this into the config file:
# Work account - default Host gitlab.com HostName gitlab.com User git IdentityFile ~/.ssh/id_rsa # Personal account Host gitlab.com-personal HostName gitlab.com User git IdentityFile ~/.ssh/id_rsa_personal
3 Update existing personal repos
- Check the git remote with this:
git remote -v
- Update with
git remote set-url origin [email protected]:ethanredmond/[REPO_NAME].git
if necessary. - Also run these to change commit names:
git config user.name "Ethan Redmond" git config user.email [email protected]
4 Cloning new personal repos
git clone [email protected]:ethanredmond/[REPO_NAME].git