1.注册一个github账号在官网。https://github.com/github
2.下载mac版的github客户端。网址:https://desktop.github.com
3.之后会在出现安装。安装成功之后,会出现这个

图标
4.打开github的客户端并且登陆客户端。
5.注意:
a.在创建工程过程中,工程的名字一定不要有" "空格出现,不然就添加不进去了。因为文件的名字在创建过程中,自动改变了,我就是吃了这个亏了。
b.包含工程最外层的文件名字可以自己更改(也就是文件路径),但是内部的工程的名字不要随意更改,并且保持Name的名字与工程名字一致。否则添加代码也会失败。

注意事项
6.

正常情况下的示例
7.

成功上传代码之后的样式
8.

重复上传的示例(已经创建过一次)
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服务器所管理的仓库。

先添加本地分之master,再实现上传
11.添加一个本地分之后,点击Commit to master,会出现下面的 画面,并且每次添加一个分之都会成为一个历史。

每次更改的内容
12.

上传代码
12.上传过程中:

上传过程中
13.上传成功之后:

上传成功之后
14.

15.

在github上展示
*****Revert this commit:撤销更改内容

实现撤销更改内容
实现撤销内容的展示:

实现撤销
好了下面再添加两个参考网址:
1.iOS 使用GitHub托管代码:http://www.jianshu.com/p/3a553eab8bfc
2.如何mac客户端上传github:http://www.jianshu.com/p/0529d66bae10
文/依然那么爱你forever(简书作者)
原文链接:http://www.jianshu.com/p/dd99a827927f
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
网友评论