Git 一台电脑使用多个平台的代码仓库该怎么搞
干就完了(下方是我自己配置)
路径
1~/.ssh/config
2文件有的可能不粗在,不存在的自己新建一个
详细内容:
1# gitee
2## o11oo11oo11o
3Host gitee.com
4User o11oo11oo11o
5HostName gitee.com
6PreferredAuthentications publickey
7IdentityFile ~/.ssh/gitee-rsa
8
9# github
10## o11oo11oo11o
11Host github.com
12User o11oo11oo11o
13HostName github.com
14PreferredAuthentications publickey
15IdentityFile ~/.ssh/github-rsa
16
17# work(不方便透露)
18## xxshare
19Host ***
20User xxshare
21HostName ***
22Port 10022
23PreferredAuthentications publickey
24IdentityFile ~/.ssh/***-rsa
生成密钥
1命令输入之后什么也不用管,拿出六亲不认的气势,一路回车
2➜ ssh-keygen -t RSA -C "xxshare.cn" -f ~/.ssh/xxshare.cn
3
4Generating public/private RSA key pair.
5Enter passphrase (empty for no passphrase):
6Enter same passphrase again:
7Your identification has been saved in /Users/fangkeke/.ssh/xxshare.cn.
8Your public key has been saved in /Users/fangkeke/.ssh/xxshare.cn.pub.
9The key fingerprint is:
10SHA256:yfFP8gqdO216/ni/Vscd9+XA42Y9OUOqwykYKnzMGEg xxshare.cn
11The key's randomart image is:
12+---[RSA 3072]----+
13| |
14| |
15| . . |
16| E . + +oo|
17|. . S o ..o*B|
18| . . . . * .+=O|
19| . = . + +.=o *|
20| + = . o.B+... |
21| o =*+oooo|
22+----[SHA256]-----+
23
确认是否生成成功
1#执行ls之后会看到有xxshare的两个文件,把xxshare.cn.pub配置到git仓库的公钥里就欧了
2➜ ~ ls ~/.ssh/
3config gitee-ras.pub gitee-rsa github-rsa github-rsa.pub ***-rsa ***-rsa.pub id_rsa id_rsa.pub known_hosts xxshare.cn xxshare.cn.pub
配置什么基本操作不在赘述 打完收工