github和gitlab共存回顾
~/.ssh/
#gitlab
Host gitlab
HostName gitlab.*.com
IdentityFile ~/.ssh/gitlab_id_rsa
#github
Host github
HostName github.com
IdentityFile ~/.ssh/github_id_rsa
bogon:.ssh bao$ ssh-keygen -t rsa -C "346126185@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/bao/.ssh/id_rsa): /users/bao/.ssh/github_id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /users/bao/.ssh/github_id_rsa.
Your public key has been saved in /users/bao/.ssh/github_id_rsa.pub.
The key fingerprint is:
SHA256:GxBJmbrvW0qX0T9TD5HnskXC8TxJxDZXvXMEpfDzFsY 346126185@qq.com
The key's randomart image is:
+---[RSA 2048]----+
| .o+ . ===|
| +. +oX=|
| .. XEO|
| . . . .@+|
| . S . + B|
| . = . . B |
| .. = + . .|
| ..+ o |
| .+. |
+----[SHA256]-----+
bogon:.ssh bao$
bogon:.ssh bao$ ssh-keygen -t rsa -C "gaotianyue@cctv.com.cn"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/bao/.ssh/id_rsa): /users/bao/.ssh/gitlab_id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /users/bao/.ssh/gitlab_id_rsa.
Your public key has been saved in /users/bao/.ssh/gitlab_id_rsa.pub.
The key fingerprint is:
SHA256:e2kin/1oTyZWNSuTB6QWRWm49vnajQOhxXI8mbSOQio gaotianyue@cctv.com.cn
The key's randomart image is:
+---[RSA 2048]----+
| .++. |
| .++ |
| o*.+o |
| ..+ @+ o |
| oS. O=+o |
| E . ..oo=+ |
| .. o.* oo |
| o B.= .oo |
| o.oo+.o..|
+----[SHA256]-----+
bogon:.ssh bao$ ls -al
total 72
drwx------ 10 bao staff 340 11 13 20:21 .
drwxr-xr-x+ 49 bao staff 1666 11 13 20:03 ..
-rw-r--r-- 1 bao staff 156 11 13 20:03 config
-rw------- 1 bao staff 1679 11 13 20:10 github_id_rsa
-rw-r--r-- 1 bao staff 398 11 13 20:10 github_id_rsa.pub
-rw------- 1 bao staff 1679 11 13 20:21 gitlab_id_rsa
-rw-r--r-- 1 bao staff 405 11 13 20:21 gitlab_id_rsa.pub
gitee操作指南
很久不再配置ssh有点手生
BAOdeMacBook-Pro:.ssh bao$ ssh -T git@gitee.com
Permission denied (publickey).
ssh-keygen -t rsa -C "346126185@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/bao/.ssh/id_rsa): gitee_id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in gitee_id_rsa.
Your public key has been saved in gitee_id_rsa.pub.
The key fingerprint is:
SHA256:4294Y+v7/CABCWtknxiPvoK2WTT5b6mDmtUD9JTuVJk 346126185@qq.com
The key's randomart image is:
+---[RSA 2048]----+
| |
| . o |
| . o E |
| . = . |
| S O |
| o # X + |
| .+=++ O.. |
| o=++*+o. . |
| .=o *OX+.. |
+----[SHA256]-----+
配置 ./ssh/config
BAOdeMacBook-Pro:.ssh bao$ cat config
#gitlab
Host gitee
HostName gitee.com
IdentityFile ~/.ssh/gitee_id_rsa
将gitee_id_rsa.pub的内容黏贴到gitee的公钥列表后还是不行
BAOdeMacBook-Pro:.ssh bao$ ssh -T git@gitee.com
Permission denied (publickey)
将id_rsa.pub的配置上才可以,这个以后继续探究
BAOdeMacBook-Pro:.ssh bao$ ssh -T git@gitee.com
Hi 高天悦! You've successfully authenticated, but GITEE.COM does not provide shell access.
参考
MacBook-Pro-GT:.ssh gty$ pwd
/Users/gty/.ssh
MacBook-Pro-GT:.ssh gty$ cat config
#github
Host github.com
HostName github.com
IdentityFile ~/.ssh/github_id_rsa
Host cctv.com
HostName cctv.com
IdentityFile ~/.ssh/id_rsa