Generate ssh-Keygen file
The configuration of ssh-key for multi-user
First account:
1 | $ ssh-keygen -t rsa -C "first@github.com" |
It will ask for ‘keygen’ filename and password you want, please set different filename for accounts.
1 | $ ssh-add ~/.ssh/filename1 |
For another accout, excute the same commands as above
1 | $ ssh-keygen -t rsa -C "first@github.com" |
If abort fatal ‘Could not open a connection to your authentication agent’
Maybe we could try:
1 | $ ssh-agent bash |
which means ssh-agent
need to start bash
.
Setup ‘config’ file
config
file is in ~/.ssh
if config
does not exit, please use touch
or vim
to generate a new config
file.
1 | $ touch config & vim config |
The config containing:
1 | # github for work |
After saving config
file, please try whether the configurate is right.
Before that, we should copy the documents in
first_filename.pub
andsecond_filename.pub
into corresponding github account, the documents start withssh-rsa
.
Now, let us test whether the configurate is right.
For first account:
1 | $ ssh -T git@github.com |
if the output is:
1 | Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. |
Which means the configuration is fine.
Now, try the second account:
1 | $ ssh -T git@personal.github.com # git@Host in config file |
If there’s no mistake, you will get:
1 | Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. |
Finally, if you want to configure hexo _config.yaml
file to push on github, you could try to revise the _config.yaml
:
1 | deploy: |