前提:在https://github.com已注册用户。
用户名:hub2hub.
邮箱:hub2hub@hotmail.com.
1、下载git:
https://git-scm.com/download
我选择了当前最新的2.10.1适用windows64的版本:git-2.10.1-64-bit.exe2
2、安装,根据提示一路往下即可。
我的安装路径:D:\program\Git
3、配置git
1)在安装路径下找到git-bash.exe双击运行
2)配置用户名、邮箱等,命令如下(用户/邮箱换成你自己的):
git config --global user.name "hub2hub"
git config --global user.email "hub2hub@hotmail.com"
3)生成key.命令如下:
ssh-keygen -t rsa -C"chjj1009@hotmail.com"
接下来会让你输入文件存储位置、密码啥的,我都用默认,直接回车即可。
4)找到C:\Users\Administrator\.ssh的文件“id_rsa.pub”文件,打开文件把key拷贝出来。
5)登录网站“https://github.com”,进入自己账户的settings页->“SSH and GPG keys”->“New SSH key”,填写title(内容随便),key的内容,从上面提到“id_rsa.pub”中拷贝粘贴,保存即可。
6)验证是否成功,输入命令如下:
git -T git@github.com
有下面提示,输入yes,结果如下:
The auth
enticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known
hosts.
Hi Hub2Hub! You've successfully authenticated, but GitHub does not provide shell
access.
4、加载一个已有的项目
我的项目(在https://github.com上的一个开源项目,可以是自己创建的,也可以是别人创建的),
运行CMD,命令如下:git clone git@github.com:boroborome/AutoBuy.git
我的项目存放位置:D:\workspace\cherryspace\AutoBuy
cmd效果如下:
d:\workspace\cherryspace>
git clone git@github.com:boroborome/AutoBuy.git
5、下载完毕在目录下你能开打整个完整项目的源代码,在本地完成你的功能开发。
6、完成后用git将代码提交到github。
7、在github网站你的账户下,你将能看到所有你提交和合入的代码。