Create key and add it to github#
Create ssh key:
1
| ssh-keygen -t ed25519 -C "your_email@example.com"
|
Add your key to agent:
1
| ssh-add ~/.ssh/elvinguti_key
|
Add key to github.
Update config#
Update ~/.ssh/config:
1
2
3
4
5
6
7
8
9
10
| Host github.com
HostName github.com
IdentityFile ~/.ssh/my_work_key
IdentitiesOnly yes
Host elvinguti.github.com
HostName github.com
User elvinguti
IdentityFile ~/.ssh/elvinguti_key
IdentitiesOnly yes
|
you might need to restart the ssh-agent:
1
| eval $(ssh-agent -s)
|
Then you should be able to clone a repo or update the git remote url:
1
2
3
4
5
6
7
| # URL Format: git@host_alias:user/repo_name.git
# Existing repo
git remote set-url origin git@elvinguti.github.com:elvinguti/elvingutidev.git`
# Clone repo
git clone origin git@elvinguti.github.com:elvinguti/elvingutidev.git
|