Comprehensive introduction to the use of Git in Android Studio (ii)

Source: Internet
Author: User

Comprehensive introduction to the use of Git in Android Studio (ii)


First article: http://blog.csdn.net/gao_chun/article/details/49817229

Iv. Studio uploads the project to GitHub

When you're done with the local git repository, how do I upload the project to a remote github repository? In fact, the operation is basically similar.

We first need to have a GitHub account, we log in to a new repository:


Here we use an example to test the name HELLONDK and create the relevant file as needed.


After the create succeeds, we can see the following interface, which is some of the operation tips from GitHub:


About Remote warehouse creation pause, the post will continue to add some knowledge about the. gitignore file and the README. Here we'll see how to use Studio to upload the project to the remote library you just created.

Note: the same as before uploading the local warehouse, you can go to create a new project, it may be an existing project, create a new project, the project location to specify the path of projects, there is not much to say.

The remote warehouse has been built and the local project is ready, so what do we need to do now? In fact, and upload to the local repository a reason, you need to create git for this project, so we do this next:


Then the following prompt box appears, select the root directory and click OK.


At this point, there is no discovery of your project's file color, has all become red it! Hasn't changed? No, I have no problem, how can you not? Is there something wrong with your environment? Do not re-install a system (open a joke ^ ^)! Look at the picture:


The next thing to do is to do something different from the previous local warehouse. Of course it is remote add , if you have installed a git for Windows client, then go to the current project root directory, right-click Git Bash, then appear the following interface, and enter the command:

Https://github.com/[username]/hellondk.git


This will be added remotely to your Git Repository,ok, we start the Add file, the Add file turns green


Next Commit and Push ..., in fact, the operation and the previous upload to the local warehouse, a little different is when the Push, you need to verify the GitHub password again.






We can go back to the GitHub page to see if the previously created repository has the code we just submitted:



v.. gitignore files and Readme files

How to write a . Gitignore file Here is a small reference:

<<<<<<< head.idea.gradle/local.properties/.idea/workspace.xml/.idea/libraries/build/ captures=======>>>>>>> 09d68fcea9510dd91ecfb99b4c06bb2dfc187b22# Built Application files*.apk *.ap_# Files for the Dalvik vm*.dex# Java class files*.class# Generated filesbin/gen/# Gradle files.gradle/build//*/build/ # Local configuration file (SDK path, etc) local.properties# Proguard folder generated by eclipseproguard/# Log files*.log& lt;<<<<<< HEAD

How to display the picture in the Readme file, such as the following effect:


Here is also a small reference, before uploading the submission, will be saved in a folder of the project, and then in the Readme file can be referenced. (Please refer to the Readme file in the open source project for other authors)



Vi. Configure GitHub and drop-down code in studio

So how do I download a project using studio on GitHub to local, and here's a summary of the recording.

First, to configure studio, open Settings in the Version Control of GitHub, enter the account password and other information.


Second, click Test, you may need to confirm the password again, then click OK.



Third, from the first interface check, from the current project check, operation or is quite simple.








Error Summary:

If you create a . gitignore file when you create a warehouse, you may receive the following error when you submit it: Updates were rejected because the remote contains work, the Thas, refer to Solution:

Http://stackoverflow.com/questions/18328800/ Github-updates-were-rejected-because-the-remote-contains-work-that-you-do-not-h


Well, that's it, basic knowledge points are almost all talked about, read to read, look at, or need to try to do. On the one hand, it is convenient for you to check later, on the other hand, of course, I hope to help you read this article. It's so cold, let me keep my hands in the cuffs.

A few good git tutorials are recommended:

First, http://www.runoob.com/git/git-tutorial.html

Second, http://blog.csdn.net/gao_chun/article/details/46774037

Third, Http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ 001373962845513aefd77a99f4145f0a2c7a7ca057e7570000



"Reprint Annotated Gao_chun blog:http://blog.csdn.net/gao_chun/article/details/49817267"

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Comprehensive introduction to the use of Git in Android Studio (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.