关于 git和github在这里就不做介绍了

准备工作

其实也没什么要准备的,主要就是安装git版本控制系统,android studio 和在github上面注册一个账号

上传新建项目到github步骤

一、android studio的git配置
打开android studio 打开如下路径File->Settings->Version Control->git(或按快捷键alt + ctrl + s到设置页面)

android post表单提交图片 android studio表单提交_github

点击test按钮如果出现 Git executed successfully 对话框说明配置成功,同时对话框会显示你安装的git版本号;如下图所示

android post表单提交图片 android studio表单提交_github_02

二、配置github登录信息
打开android studio 打开如下路径File->Settings->Version Control->Github(或按快捷键alt + ctrl + s到设置页面),如下图所示

android post表单提交图片 android studio表单提交_android studio_03

Password:就是github密码

填完之后点击test按钮,如果出现如下对话框说明配置成功

android post表单提交图片 android studio表单提交_android post表单提交图片_04

三、上传工程到github上

打开你要上传的工程,顶部菜单选择VCS->Import into Version Control->Share Project on GitHub,如下图所示

android post表单提交图片 android studio表单提交_android_05

如果你是第一次提交该项目会出现如下两个对话框对话框,第一个提示输入你的Master password,第二个提示你这是一个新的存储库(repo),可以自定义repo的名字,和添加描述。

android post表单提交图片 android studio表单提交_github_06

android post表单提交图片 android studio表单提交_android post表单提交图片_07

填写完毕点击share按钮如果你的工程没有问题会出现如下界面

android post表单提交图片 android studio表单提交_github_08

点击ok,如果提交成功studio右上角会提示相关信息

android post表单提交图片 android studio表单提交_android_09

此时打开你的github网站地址在你的repositories中会看到刚刚提交过的工程名称,点击进去会看到完整的提交工程,到此提交结束

android post表单提交图片 android studio表单提交_git_10

项目更新

一、如果你的项目新增了一个类,当你创建该类的时候会提示你是否需要加入git,如下图所示

android post表单提交图片 android studio表单提交_android_11

选择yes该类就会加入git,同时该类本身的颜色会有改变

android post表单提交图片 android studio表单提交_android post表单提交图片_12

此时该类右击->Git->COmmit File… 出现如下对话框

android post表单提交图片 android studio表单提交_android_13

填写 commit message 后点击Commit按钮,有可能会出现如下警告,忽略它点击Commit

android post表单提交图片 android studio表单提交_android post表单提交图片_14

再次右击->Git->Repository->Push,如下图所示

android post表单提交图片 android studio表单提交_android_15

点击Push出现如下对话框,点击Pust按钮

android post表单提交图片 android studio表单提交_android studio_16

此时打开你的github上的该项目源码,你会发现新增的类已经出现了

android post表单提交图片 android studio表单提交_git_17

二、如果你的项目中某个类进行了修改需要重新提交

右击该类->Git-Add

android post表单提交图片 android studio表单提交_android studio_18


这步其实是把该类加入到git中,后面的步骤和新增类的操作一样,这里不再赘述。