转:

  

How to use GitHub with Android Studio

This article will explain how to use GitHub with Android Studio.

Firstly, let’s login togithub.comand create a new repository. From the top right corner of the screen, click the+sign and selectNew repository.

Now complete the form to create a new repository calledtestproject. Leave theInitialize this repository with a READMEunticked.

Next, openAndroid Studioand create a new project. Call your new applicationTestProject. ClickNextto continue.

Leave the next page as defaultand clickNext.

On theAdd an activity to Mobilescreen selectBlank Activityand clickNext.

In the next screen, leave the defaultactivity name of MyActivity and click Finish.

Your new project will open in Android Studio. On the top menu, selectVCS>Import into Version Control>Create Git Repository.

On the next screen, leave it all as default and clickOK.

Now use Internet Explorer and navigate to the root of your projects folder. Right click and selectGit Bash(If you do not see this option, then first installGit for Windows).

When the Git bash screen appears, type:

1 git remote add originhttps: //github .com/[username]/[project_name].git

An example of a Git repository URL is:https://github.com/markwint/testproject.git

Then press enter. The GitHub remote will be added to your Git repository.

Next, jump back into Android Studio, right click your projects root directory and selectGit>Add. This will add all your project files to your Git repository.

It will seem like nothing has happened, but trust me, the project files are added.

Now right click the project name again and this time selectGit>Commit Directory.

In the next screen, type aCommit Messageand selectCommit.

If a Code Analysis warning appears, clickCommit. (Unless it’s a real project, in which case review and fix the issue before committing!)

Now, right click the project name, selectGit>Repository>Push.

Check the boxPush current branch to alternative branchand leave the branch name asmaster. Then selectpush.

Now enter your GitHubLogin(email address)andPassword. Then clickOK.

If it’s all good, you will see this message.

Now your code is pushed to your GitHub repository. Don’t believe me? Logon and check for yourself.

Hope that was helpful.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Oracle收集统计信息
  2. Oracle 12c 新SQL提示(hint)
  3. Oracle的告警日志之v$diag_alert_ext视图
  4. Oracle行列互换总结
  5. Oracle的SYS用户登录报权限不足(ORA-01031
  6. Oracle中的优化器--CBO和RBO
  7. 网站收录和排名关系,是不是收录越多,排名越
  8. 如何给自己的GitHub项目增加各种图标
  9. 【GoCN酷Go推荐】Go 类型转换神器 cast库
  10. 静态网站(博客)生成器Static Site Genera