First, create a repository on github: select Repositories, click "New" on the right, enter the repository name, and click "create repositories".
git configuration of studio;
After installing git, start Androidstudio and open the following path File->Settings->Version Control (expand)->git
Enter the git path you installed in the input box after Path to Git executable, as shown in the following figure:
Click the test button if the Git executed successfully dialog box appears, indicating that the configuration is successful, and the dialog box will display the version number of git you installed; as shown in the following figure
2 Configure github login information;
Open the following path File->Settings->Version Control (expand)->GitHub, as shown in the following figure
Fill in the following information:
Host:github.com
Login: your github account name
Password: your github account password
After filling in, click the test button. If the following dialog box appears, the configuration is successful.
3 Upload the project to github
Open the project you want to upload, and select VCS->Import into Version Control->Share Project on GitHub from the top menu, as shown in the following figure:
If you are submitting the project for the first time, the following dialog box will appear, prompting you that this is a new repository (repo), you can customize the name of the repo and add a description.
After filling in, click the share button. If there is no problem with your project, the following interface will appear.
The classes to be submitted, as well as various resource configuration files, etc. are listed here, click the ok button
Enter your Master password and click ok. If the submission is successful, the upper right corner of the studio will prompt relevant information
At this point, open your github website address and you will see the name of the project you just submitted in your repositories, click it and you will see the complete submitted project, and the submission is over.
project update
When a new module is added to the project or the module modifies how to update the project on github, it is actually very simple.
1 If a new class is added to your project, you will be prompted whether you need to join git when you create the class, as shown in the following figure
Select yes and the class will be added to git, and the color of the class itself will change (from normal white to green under the Darcula theme)
At this point, right-click on the class ->Git->COmmit File... The following dialog box appears
After filling in the commit message and clicking the Commit button, the following warning may appear, ignore it and click Commit
Right-click again ->Git->Repository->Push, as shown below
Click Push to display the following dialog box, click the Push button
At this point, open the source code of the project on your github, you will find that the new class has appeared
2 If a class in your project has been modified, it needs to be resubmitted;
Right click on the class -> Git-Add
If push faild occurs, you can use another method to upload:
Find the local path of the project;
Right-click on the selected project and select "git";
Select push;
Select "Other", and fill in the Https copy of the repository created by github: https://github.com/*****/***.git;
Click OK;
Enter the github account and password;
Finish.