github这个就不介绍了,在linux下的话很方便,安装git及ssh就可以直接下了,但在windows上面呢,问题就来了,说说怎么下上面的源代码吧; 安装cygwin,在安装cygwin时,选择git及openssh进行安装,安装方法及步骤就不讲了,网上一堆,重点关注一下,怎么下代码
git连接都需要一个publickey,所以我们要先来生成一个publickey(以下都需要在cygwin中输入命令)
1 检测是否已经有了SSH key
ls -la ~/.ssh
检查显示的列表中是否有id_rsa.pub及id_dsa.pub,如果没有则进入第2步,否则跳到第3步
2 生成 一个新的SSH key
ssh-keygen -t rsa -C "your_email@example.com"
后面是注册github时填写的email,如:ssh-keygen-t rsa -C xxxx@sina.com;输入完整的命令后,回车需要输入一些东西,默认回车就行,最后会出现如下的字符串,即生成成功
The key fingerprint is: 2c:4d:14:04:89:8f:91:a2:a3:ed:5e:as:6d:2e:6d:0f xxxx@sina.com The key‘s randomart image is: +--[ RSA 2048]----+ | o . | | o + o | | . + . + . | | . + . . . | | o . . S . | |oEo . . . | |+oo. o . | |.... o.. | |. .o | +-----------------+
3 把生成的key加入到github中
登录后,进入这个地址:https://github.com/settings/ssh
把刚才生成的 /home/xxx/.ssh/id_rsa.pub这个文件打开,复制里面所有的内容,添加到SSH-keys中,保存;
4 验证是否可以连接成功
ssh -T git@github.com
The authenticity of host ‘github.com (207.97.227.239)‘ can‘t be established. # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. # Are you sure you want to continue connecting (yes/no)? Don‘t worry! This is supposed to happen. Verify that the fingerprint in your terminal matches the one we‘ve provided up above, and then type "yes." # Hi username! You‘ve successfully authenticated, but GitHub does not # provide shell access.
显示这些说明已经连接成功;下面就是clone代码了,这个简单:
git clone xxxx后面是要下代码的地址;好了,在github上下代码的讲简就此结束,不知道有没有写清楚;
参考:https://help.github.com/articles/generating-ssh-keys