码迷,mamicode.com
首页 > 移动开发 > 详细

如何使用 Android Studio 的 git hub 功能

时间:2016-03-21 11:59:18      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

How to use GitHub with Android Studio

 

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

Firstly, let’s login to github.com and create a new repository. From the top right corner of the screen, click the +sign and select New repository.

技术分享

Now complete the form to create a new repository called testproject. Leave the Initialize this repository with a README unticked.

技术分享

Next, open Android Studio and create a new project. Call your new application TestProject. Click Next to continue.

技术分享

Leave the next page as default and click Next.

技术分享

On the Add an activity to Mobile screen select Blank Activity and click Next.

技术分享

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

技术分享

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

技术分享

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

技术分享

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

When the Git bash screen appears, type:

1
git remote add origin https://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 select Git > 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 select Git > Commit Directory.

技术分享

In the next screen, type a Commit Message and select Commit.

技术分享

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

技术分享

Now, right click the project name, select Git > Repository > Push.

技术分享

Check the box Push current branch to alternative branch and leave the branch name as master. Then select push.

技术分享

Now enter your GitHub Login (email address) and Password. Then click OK.

技术分享

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.

 

如何使用 Android Studio 的 git hub 功能

标签:

原文地址:http://www.cnblogs.com/zhujiabin/p/5300947.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!