Git
Git SSH Key Managing Command
date
Apr 11, 2023
slug
Git SSH Key Managing Command
author
status
Public
tags
Github
summary
how can manage SSH key in git.
type
Post
thumbnail
category
Git
updatedAt
Apr 11, 2023 01:39 PM
SSH rsa key gen in local storage
2 cd ~/.ssh
3 ls -al
# SSH Keygen
5 ssh-keygen -t rsa -C "gitId1@gmail.com" -f "id_rsa_gitId1"
6 ssh-keygen -t rsa -C "gitId2@gmail.com" -f "id_rsa_gitId2"
16 cd ~/.ssh
17 eval "$(ssh-agent -s)" # activate ssh
18 ssh-add ~/.ssh/id_rsa_[gitId1]
19 ssh-add ~/.ssh/id_rsa_[gitId2]
register SSH rsa public key to web gitid setting. (setting - ssh)
22 code ~/.ssh/id_rsa_[gitId1].pub
23 code ~/.ssh/id_rsa_[gitId2].pub
SSH config setting
code ~/.ssh/config
config
Host github.com
HostName github.com
User [gitId1]@gmail.com
IdentityFile ~/.ssh/id_rsa_[gitId1]
Host github.com
HostName github.com
User [gitId1]@gmail.com
IdentityFile ~/.ssh/id_rsa_[gitId2]
Then clone via SSH using host
when want to change host name like this
Host github.com
HostName github.com
User [gitId1]@gmail.com
IdentityFile ~/.ssh/id_rsa_[gitId1]
Host github.com.workplace
HostName github.com
User [gitId1]@gmail.com
IdentityFile ~/.ssh/id_rsa_[gitId2]
git@[Host]:DSDanielPark/deeptechlog.git
git@github.com.workplace:DSDanielPark/deeptechlog.git