1. github配置

1. 安装:官网傻瓜式安装

2.密钥的生成:为了不让不想干的人提交代码,所以需要一个密钥

执行这个命令 : 

ssh-keygen -t rsa -C "邮箱地址"

然后一直回车键回车键就可以

在第二个蓝色的框哪里就是出现密钥的存储位置

 然后,登陆github,点击settings(设置)

ssh and ...

点击添加

点击add shh key。这样本地和github建立了通信基础

那么,如何配置多个呢?先配置一个。

1.  cd ~/.ssh

2.vim config

3.添加Host/HostName/User/IdentityFile  四项

Host github.com

HostName github.com

User peixm 

 

 

IdentityFile  /Users/newcomer/.ssh/id_rsa(绝对路径)

 

以下是文件的样子:

但是多个呢?首先将id_rsa改名字,比如改成id_rsa_mine。 (mv id_rsa id_rsa_mine

然后在进行各种的add shh key,然后将id_rsa改名成 比如 id_rsa_公司

文件的样子就是

#个人git

Host github.com

HostName github.com

User peixm 

IdentityFile  /Users/newcomer/.ssh/id_rsa_mine

#公司git

Host 自己公司的名字

HostName 自己公司的地址比如(github.geo.apple.com)

User peixm 

IdentityFile  /Users/newcomer/.ssh/id_rsa_公司

 

猜你喜欢

转载自www.cnblogs.com/peiminer/p/9276712.html
今日推荐