iOS 使用GitHub托管代码
Posted 朝阳
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS 使用GitHub托管代码相关的知识,希望对你有一定的参考价值。
1.注册一个github账号在官网。https://github.com/github
2.下载mac版的github客户端。网址:https://desktop.github.com
3.之后会在出现安装。安装成功之后,会出现这个
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-a9a711f0dcdee2d2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
4.打开github的客户端并且登陆客户端。
5.注意:
a.在创建工程过程中,工程的名字一定不要有" "空格出现,不然就添加不进去了。因为文件的名字在创建过程中,自动改变了,我就是吃了这个亏了。
b.包含工程最外层的文件名字可以自己更改(也就是文件路径),但是内部的工程的名字不要随意更改,并且保持Name的名字与工程名字一致。否则添加代码也会失败。
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-81bb03a8a6fb4194.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
6.
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-24d63ba4c51f9502.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
7.
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-9316c721a93464c4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
8.
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-9da0d085d9cb4272.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
9.若如上图所示,提示A repository already exists here则可能是你重复上传github,则会在本地产生相应的.git文件,该文件为隐藏文件,需要删除所有.git目录,可在终端执行以下命令:
显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles YES
隐藏Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles NO
重启finder(command+option+esc,选中finder重启),找到相应工程删除所有文件夹下的.git文件,重新Create Repository(创建工程)即可。
10.先添加Changes到master分支,编辑好描述后点击Commit to master:
注意:"Commit to master"意为提交到master分支,它是将代码存到本地仓库,然后通过push的方式将本地仓库同步到Github服务器所管理的仓库。
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-36e3515b1270b4b5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
11.添加一个本地分之后,点击Commit to master,会出现下面的 画面,并且每次添加一个分之都会成为一个历史。
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-e19dedb279ceeb08.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
12.
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-914009c1208d9b24.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
12.上传过程中:
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-4d1d519c58f048de.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
13.上传成功之后:
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-8fe02ad1fe5f54d4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
14.
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-a318f1d5ca56b8d8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
15.
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-627f69926af75eb0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
*****Revert this commit:撤销更改内容
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-f4685e879b2c1acc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
实现撤销内容的展示:
![技术分享](http://upload-images.jianshu.io/upload_images/1025776-888a1a6d7d93a005.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
原文链接:http://www.jianshu.com/p/dd99a827927f
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
以上是关于iOS 使用GitHub托管代码的主要内容,如果未能解决你的问题,请参考以下文章