你的位置:首页 > 软件开发 > 操作系统 > 如何使用 Android Studio 的 git hub 功能

如何使用 Android Studio 的 git hub 功能

发布时间:2015-07-16 10:00:08
This article will explain how to use GitHub with Android Studio.Firstly, let’s login to github.com and create a new repository ...

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.

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

Leave the next page as default and click Next.

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

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

如何使用 Android Studio 的 git hub 功能

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.

如何使用 Android Studio 的 git hub 功能

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.

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

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

如何使用 Android Studio 的 git hub 功能

Hope that was helpful.

 


原标题:如何使用 Android Studio 的 git hub 功能

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录