一、Git是什么?
Git --- The stupid content tracker, 傻瓜内容跟踪器。Git是目前世界上最先进的分布式版本控制系统。
二、SVN与Git的最主要的区别?
SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以首先要从中央服务器哪里得到最新的版本,然后干活,干完后,需要把自己做完的活推送到中央服务器。集中式版本控制系统是必须联网才能工作,如果在局域网还可以,带宽够大,速度够快,如果在互联网下,如果网速慢的话,就纳闷了。
Git是分布式版本控制系统,那么它就没有中央服务器的,每个人的电脑就是一个完整的版本库,这样,工作的时候就不需要联网了,因为版本都是在自己的电脑上。既然每个人的电脑都有一个完整的版本库,那多个人如何协作呢?比如说自己在电脑上改了文件A,其他人也在电脑上改了文件A,这时,你们两之间只需把各自的修改推送给对方,就可以互相看到对方的修改了。
三、准备工作
当然是准备在windows 下使用需要的环境,和工具。
msysgit 下载地址:https://git-for-windows.github.io/
TortoiseGit 下载地址:https://code.google.com/p/tortoisegit/wiki/Download有语言包可下载
我下载完成后就是这个样子的(包含语言包)
![](https://upload-images.jianshu.io/upload_images/1459766-c2bafc847666e2a7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
四、安装
首先安装:
![](https://upload-images.jianshu.io/upload_images/1459766-feadcc6cdfcd8de7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
开始安装:
![](https://upload-images.jianshu.io/upload_images/1459766-fc8a8b859834a408.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-f56d873f5843c185.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-12bd59620de3ce64.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
修改安装路径,然后下一步
![](https://upload-images.jianshu.io/upload_images/1459766-4abb293775ea3d05.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-15c62cc94cb89b2a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-8175219d869054c1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-a7fd8b777d6eaa67.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
按照图片上的意思选择(我选择的是Checkout as-is,commit Unix-style line endings),然后下一步(Next),这样就安装完成了,
接着安装:
![](https://upload-images.jianshu.io/upload_images/1459766-8cec7e3576f84c7c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-052301e89aba558a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-a1acc77105b386a1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-9ee4bb0bcac2ba55.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-0fc66009417ada3d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
修改安装路径,其他的默认,然后下一步(Next)
![](https://upload-images.jianshu.io/upload_images/1459766-4de2c52a0036596d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接 选择安装(Install)
![](https://upload-images.jianshu.io/upload_images/1459766-d61ee04a536c7f08.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
这样就安装完成(Finish).
然后汉化:
![](https://upload-images.jianshu.io/upload_images/1459766-7f16d5bbe106cd8b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-69a2c42dbff432dd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
直接下一步
![](https://upload-images.jianshu.io/upload_images/1459766-cd69ef47d90cb280.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
汉化完成。
然后设置语言:
![](https://upload-images.jianshu.io/upload_images/1459766-75e74d0b0ab27e19.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-626bca6bf9057db4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
这样准备工作就做完了。
这样就开始第二步,
在http://git.oschina.net/上申请账户,然后在新建一个项目(或者要人把你加入别人的项目中)
然后:
![](https://upload-images.jianshu.io/upload_images/1459766-375a05aafcb6ca95.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击红色框位置的项。
![](https://upload-images.jianshu.io/upload_images/1459766-606f9fb5b4a8d6fe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击 Generate
![](https://upload-images.jianshu.io/upload_images/1459766-6f6162528d328ab7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-c2b6cc920f2f1634.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-6018a018b16d4e48.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-6a22d2fb11d2ef5a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
选择一个文件夹 取一个名字 放 .ppk 文件(记住.ppk文件放的文件夹,后面会用到)
如果你还没有在开源中国上参加一个项目或者新建一个项目 现在到开源中国上建立一个项目
创建项目(介于一些第一次用OSChina的朋友找不到地方我还是写清楚)
![](https://upload-images.jianshu.io/upload_images/1459766-41b3512f548bd800.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
然后
![](https://upload-images.jianshu.io/upload_images/1459766-260b1ab94d22bfe9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
一个初始化好的私有项目就创建好了
接着
![](https://upload-images.jianshu.io/upload_images/1459766-df0028e0a1bfabe9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-c18cbf72eb88868f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
然后点击SSH 公钥
![](https://upload-images.jianshu.io/upload_images/1459766-26246b582bf7bcf4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-85cab6ea10f09b32.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
保存了之后 点击你的头像
![](https://upload-images.jianshu.io/upload_images/1459766-1a74c0bd27302c9e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
出来一个界面 右边可以看到项目列表如下图
![](https://upload-images.jianshu.io/upload_images/1459766-b3b06e88d8356b6f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击一个项目
![](https://upload-images.jianshu.io/upload_images/1459766-f4dbfeb29dc62741.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
选择SSH 然后右边的小按钮是复制(就是下面说到的 git克隆 里面URL 项中要要填的)
————————————————————————————————————————————————————————————————————————————————————
然后在你的电脑上选择一个文件夹进入文件夹 然后右键
有一个 git 克隆 点击
![](https://upload-images.jianshu.io/upload_images/1459766-717c119c62e5f65e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
截图是忘记选择递归了。记得勾选递归。然后确定。
![](https://upload-images.jianshu.io/upload_images/1459766-d5b445e706915d7c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/1459766-d40d322a86ab3df1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
克隆成功,你建的项目一些配置文件会被下载下来
这样你就可以在下载下来的文件夹里面建项目了
建了项目后提交
就在文件夹上面右键 git 提交
![](https://upload-images.jianshu.io/upload_images/1459766-74ae963dd2f310ac.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
填写说明,设置作者日期,设置作者,勾选要提交的改变。然后确定。
![](https://upload-images.jianshu.io/upload_images/1459766-2a27cf6443e3ccb0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
选择推送
![](https://upload-images.jianshu.io/upload_images/1459766-422b613a66f309d4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
然后 确定
![](https://upload-images.jianshu.io/upload_images/1459766-4edc41335a59cbf4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
可以看见推送成功,就可以在 在代码托管平台 开源中国上看见你提交的代码了。
参考文章:
http://blog.jobbole.com/tag/git/
http://www.open-open.com/lib/view/open1414396787325.html
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/
http://git.oschina.net/progit/
http://git.oschina.net/oschina/git-osc/wikis/Home
一路走来数个年头,感谢RDIFramework.NET框架的支持者与使用者,大家可以通过下面的地址了解详情。
RDIFramework.NET官方网站:http://www.rdiframework.net/
RDIFramework.NET官方博客:http://blog.rdiframework.net/
同时需要说明的,以后的所有技术文章以官方网站为准,欢迎大家收藏!
RDIFramework.NET框架由专业团队长期打造、一直在更新、一直在升级,请放心使用!
欢迎关注RDIFramework.NET框架官方公众微信(微信号:guosisoft),及时了解最新动态。
扫描二维码立即关注