gitHub是一个代码托管服务的提供商,可以提供个人或者企业的代码托管,同时它也是一个巨大的开源社区。-- https://github.com/
对于企业的代码协作,如果采用http的方式登录,那么每次进行需要交互的操作时,都必须输入账户密码,于是我们设置ssh key,只要安装好密钥,就不必这么麻烦啦。下面就是生成github.com repo的ssh key的记录:
BruceChan@changjiang MINGW32 ~/.ssh $ ssh-keygen -t rsa -C "<email address>" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/BruceChan/.ssh/id_rsa): id_rsa Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa. Your public key has been saved in id_rsa.pub. The key fingerprint is: SHA256:nfT3BPsc06PGBRxV2dw0Ee6LpUBTkLSD9cWAZyF+N3w <email address> The key's randomart image is: +---[RSA 2048]----+ | .=+==OX| | +o*o=o=| | ..*o=.=E| | o.o+ +o+| | S o.. oBo| | o.*==| | * .+| | . | | | +----[SHA256]-----+
接下来需要将id_rsa.pub中的内容放到远程仓库里,一般都是在远程仓库的设置,ssh key设置里,完成后会在页面上以列表的形式出现。
最后检验:
BruceChan@changjiang MINGW32 ~/.ssh $ ssh -T git@github.com Enter passphrase for key '/c/Users/BruceChan/.ssh/id_rsa': Hi changjiangChen-BruceChan! You've successfully authenticated, but GitHub does not provide shell access.
<注>--此处用git-hub_rsa的密钥时,该命令会出现 Permission denied,于是采用之前的id_rsa
另外,由于在设置密钥rsa时,输入的密码,导致都要输入这个密码。如果输入密码时直接跳过,就可以不用输入。