A blog on using Git in Android Studio.


GitHub is an Internet hosting service for software development and version control using Git. It provides distributed version control, bug tracking, software feature requests, task management, continuous integration, and wikis for every project. By integrating your current project with git using the Android studio, you can achieve instant access to shared projects, quick upload of source code to repos, and much more with the built-in initial commit option.

To begin with, make sure you have installed the latest version of Android Studio with the latest SDK and Gradle version.

Install Git on your computer by clicking here.”

  1. Open the Android Studio with a new project and a template activity with which you are compatible with.
Here, I chose Empty Compose Activity

2. Look for the VCS button in the toolbar and select the “Share project on GitHub” option.

Share the project on GitHub

3. After selecting the “Share project on GitHub” button, you will get this secondary window asking for a version control system to associate with BlogonGit3 ’. Here, select Git as your preferred version control system and click on OK.

Enable the integration of version control integration

4. To confirm your integration with Git, a confirmation message will appear at the bottom, commenting that a git repository has been created successfully in local storage.

Look in the bottom left corner of your Android Studio window

5. Also, to double-check, carefully notice that all the file names on the Project tab will turn orange. The VCS button on the toolbar will disappear, replaced by a new button “Git”.

AS window after successfully integrating with git

6. Following successful integration with git6, upon completion of the coding segment in the project, the project file can be shared on GitHub by clicking the “Git” icon on the toolbar and selecting “GitHub>Share” project on GitHub.

The project should be shared on GitHub7

7. In the newly popped window, assign a name to the repository and choose the remote as its origin. On completion of installation and set up of Github, in the “share by” box the user name is displayed. [Illustration 9]. If you can see your username, go to step number 9. Otherwise, proceed to the next step.

Once you’ve completed all of the buttons, click the Share button.

8. If there is no username on the ‘share by’, it means the account is yet to be connected with the installed GitHub on the computer. To connect, give the share in the ‘Share project on GitHub’ window, and consequently, an ‘Add Account’ window will pop out. Here it will ask for a token for the GitHub account. You can acquire one for your account by simply clicking on the generate button or click here to open the official website to generate a token for yourself. To integrate your account with the installed GitHub application, copy the token, paste it in the box, and click “Add account”.

Paste your token in box 9

9. After successfully adding your account to Git, you can share your repository directly from Android Studio to your GitHub account.

Click “share” after the successful addition of your account.

10. Now it’s time to make your initial commitment — the selection of files that must be posted on the repo. Select all the required files and hit the “add” button to directly send all the selected files to the destined repo.

Initial commit

11. Here is your confirmation popup message on the right bottom corner to announce that the commit was successful.

Commit confirmation

You have now successfully merged Android Studio with GitHub and shared your project files with your account through a repository. What if you have to make some changes in the coding part? You must update your repository by committing once again and pushing the commit to your repository. It is just like replacing the existing project files with new ones.

12. Your project is now under version control and shared on GitHub. You can start making changes to commit and push. Notice that after I made the change, the MainActivity.java file turned blue. That means the file now has uncommitted changes (and it doesn’t match the file in the GitHub repository).

Uncommitted activity file

13. Now it’s up to you to commit to keeping track of your activities and progress. You can even push the changes after every amendment, or whenever you wish to. To do so, navigate to Git > Commit… or press (ctrl+K) to open the commit tab on the left side of the window.


14. Filling in the commit prompt is compulsory. But it is not mandatory to write the number of commits. You can name the current commit as you like or as understandable by the user. It is just to notify the user that this file has been modified or updated. After filling in the prompt, click the “Commit and Push” button for the next window.

Commit and push

15. Here, just look at the modified files that have to be changed in the repo and hit ‘push’ to change them on the website also.


Here is the confirmation popup message for the successful commit and push.

And boom! You now know how to keep track of your project while contributing to the GitHub platform directly from the Android Studio application. It will save you a lot of time and data, and comparatively, this method is easier to constantly update on GitHub rather than uploading manually there every once in a while.

I, Jai Surya, from the Google Developer Student Clubs, SASTRA, contributing to this blog to help all my peers. Do clap if you find this useful.



Google Developer Student Clubs, SASTRA

GDSC, SASTRA chapter is a community-based program that aims to guide students to learn and grow by connecting the bridge between theory and practice.