You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ssh-keygen -t rsa -C "name@your.domain"# Generating public/private rsa key pair.# Enter file in which to save the key (/home/rainyear/.ssh/id_rsa): /home/rainyear/.ssh/id_rsa_coding
一般私人的Git远程仓库采用SSH方式进行
git push & git pull
操作,而不用每次输入用户名和密码。其中的原理是采用SSH协议,将公钥(如~/.ssh/id_rsa.pub
)上传到服务端,客户端保留私钥(如~/.ssh/id_rsa
)。创建密钥的指令:一直回车就可以在
~/.ssh/
目录下分别生成一个公钥文件和一个私钥文件。虽然就目前来看SSH协议还是安全的,也就是说其他人活的公钥之后是无法推算出私钥的。但是为了谨慎起见,最好还是不要到处暴露同一公钥。例如我在github.com上保存了自己的SSH-key(也就是~/.ssh/id_rsa.pub
),那么在另外一家服务如coding.io最好采用另外一对私钥/公钥,这时需要创建新的密钥:生成新的密钥
~/.ssh/id_rsa_coding & ~/.ssh/id_rsa_coding.pub
,然后添加配置文件~/.ssh/config
:将
~/.ssh/id_rsa_coding.pub
添加到coding.io帐号的SSH-key,接下来针对不同域名下的远程仓库,git
将实用不同的私钥进行SSH操作。The text was updated successfully, but these errors were encountered: