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