2013.11.04——— git学习之生产key

2013.11.04———git学习之生产key

参考:http://blog.csdn.net/hustpzb/article/details/8230454

之前我们学习过设置全局变量gitconfig的命令,如果我们已经设置了name和email的话,就可以直接生成key了

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Sun/.ssh/id_rsa):
/c/Users/Sun/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Sun/.ssh/id_rsa.
Your public key has been saved in /c/Users/Sun/.ssh/id_rsa.pub.
The key fingerprint is:
d2:94:67:b3:2c:d9:42:95:56:75:d0:bf:0b:8a:5f:08 Sun@COSTARTER

它先要求你确认保存公钥的位置(.ssh/id_rsa),然后它会让你重复一个密码两次,如果不想在使用公钥的时候输入密码,可以留空

然后会在当前目录下(可以用pwd来查看当前目录路径)生成一个.ssh的文件夹,里面有两个文件,通常是id_dsa或者id_rsa。

其中,.pub文件是公钥,另一个文件是密钥

然后把公钥发给git管理员,这样就可以下载代码了

相关推荐