-
下载git客户端,并且安装
下载地址:https://git-for-windows.github.io/
-
配置android studio,需要提前注册号github账号
a1.png
然后点击Test按钮会有成功的提示,点击OK
a2.png
点击Test按钮,成功会提示,点击OK
-
上传工程到github
a3.png
如果你是第一次提交该项目会出现如下对话框
a4.png
填写完毕点击share按钮如果你的工程没有问题会出现如下界面
a5.png
这里列出了将要提交的类,以及各种资源配置文件等等,点击ok按钮注意:这一步容易出现上传失败,究其原因,是没有在git-bash中进行配置:
Can't finish GitHub sharing process
Successfully created project 'Demo' on GitHub, but initial commit failed:
*** Please tell me who you are. Run Git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for (null)>) not allowed during executing git -c core.quotepath=false commit -m "Initial commit" --
看了一下错误原因:Run git config --global user.email "you@example.com" git config --global user.name "
原来是git没有配置的原因,找到git安装目录下的Git Bash运行后输入下面两行代码即可:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
a6.png
如果提交成功studio右上角会提示相关信息此时打开你的github网站地址在你的repositories中会看到刚刚提交过的工程名称,点击进去会看到完整的提交工程,到此提交结束
a7.png
-
项目更新
当项目新增了模块或者模块修改了如何更新github上的项目,其实也很简单。
a8.png
选择Yes之后新增的文件是以绿色标注的,表示是新增的文件(白色表示之前提交已经是最新的,蓝色表示之前提交但已做了修改),如果需要提交新增的文件只需要该类右击->Git->COmmit File... 出现如下对话框:
a9.png
填写 commit message 后点击Commit按钮,有可能会出现如下警告,忽略它点击Commit
a10.png
点击Push出现如下对话框,点击Pust按钮
a11.png
此时打开你的github上的该项目源码,你会发现新增的类已经出现了
a12.png
如果你的项目中某个类进行了修改需要重新提交右击该类->Git-Add
a13.png
感觉这步没什么变化?其实不是,这步其实是吧该类加入到git中;
以后的步骤和新增类的操作一样,这里不再赘述。













网友评论