Git(2.14.1版本)学习及使用(一)
OuZeBo原创作品。转载请注明出处 http://www.cnblogs.com/OuZeBo/p/7477465.html1、下载git:https://git-scm.com/
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905102950116-1038516078.png
2、安装(本人选择默认路径,下一步-->end)
3、注册github账号
4、git的简单配置
$ git config --global user.name yourName
$ git config --global user.email yourEmail@xxx.com
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905103551882-1307151655.png https://images2017.cnblogs.com/blog/734610/201709/734610-20170905104258491-898896118.png
5、github配置添加SSH
$ ssh-keygen -t rsa -C "yourEmail@xxx.com"
ssh-key的生成路径(默认路径):C:/user/administrator/.ssh下的id_rsa.pub文件下
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905105442319-973734737.png
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905110103726-1494243687.png
6、将ssh配置到GitHub中
将id_rsa.pub用记事本打开,将里面内容复制到github ssh配置中的key
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905105732397-1771943584.png
7、创建本地仓库
可参考:http://www.runoob.com/git/git-create-repository.html
$ git clone <github项目仓库路径> <本地项目路径>
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905110426882-552041766.png
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905110700960-1308331344.png
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905110624663-1290349626.png
8、上传文件到github仓库
手动创建d.txt
$ git add d.txt
$ git commit //将文件上传到本地仓库
$ git push //将文件上传到guihub项目仓库
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905164504679-514246375.png
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905163538007-396338481.png
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905164602069-38489193.png
注:在$ git commit过程中,可能出现这个错误(E325:注意Aborting commit due to empty commit message.):
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905165143835-1389683655.png
这个错误是在git 提交时没有写注示文字
操作:新建一个命令窗口,输入: $ git commit -m "注释文字"
9、下载github项目仓库文件
$ git pull
https://images2017.cnblogs.com/blog/734610/201709/734610-20170905164805335-140939678.png
页:
[1]