Link an item to git using Xcode, Android Studio

Source: Internet
Author: User

First, create a local git repository using Android Studio:

1, check the local git environment: setting-->version Control Click on the Test button in Android studio, prompting success to prove that the local git environment has been built;

2, the new project;

3. After creating the project, select Vcs->import into Version control->create Git Repository in the toolbar.

After the successful creation we did not add the file to the local warehouse will turn red, and then right-click on the project, found a git option, mouse over the GIT option, in the right pop-up menu to choose the Add option, before the red file has become a green file, choose the Git menu again, In the right pop-up menu, select Commit Directory, submit to the local repository, select the file you want to submit in the pop-up window, fill in the Commit Message, and click the Commit button to submit to the local repository. (The Commit button can also choose commit and push, but we don't have a remote repository at this point, so don't rush it)

Second, create a local git repository using Xcode:

Xcode is simple to create a local warehouse, just tick the source control:create Git repository on My mac when you create a new project.

Third, local git repository and remote warehouse link:

CD to the directory where you just created the local warehouse project, and then add origin to the remote repository (with the URL of the remote repository you just created), take Oschina as an example:

Git remote add Origin https://git.oschina.net/XXXXXX.git

Then push to the trunk of the remote repository

Git push-u Origin Master

It is important to note that if a Readme file is created at the same time as the repository is created, because the versions are inconsistent, the direct push will give an error and need to be executed first

Git pull-u Origin Master

To merge the warehouse and then push,

The local project is now created with a link to the remote Git repository, and the local project will be updated directly to commit and push.

If you are in Git remote add Origin https://git.oschina.net/XXXXXX.git hint Fatal:remote origin already exists. Workaround:

1. First enter GIT remote RM origin

2, then enter GIT remote add Origin https://git.oschina.net/XXXXXX.git will not error.

Link an item to git using Xcode, Android Studio

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.