How to Upload Android Studio Project to GitHub?
Tags: android, github, beginners
Published: 2021-10-22 22:36:03

**Simple and beginner-friendly step-by-step guides to share your Android project in GitHub repository**

The good thing about using Android Studio to upload your files to GitHub is it automatically figures out for you what files are required to commit and push to GitHub. For example, generated files are not required to commit and push to GitHub.

The following provides the step-by-step instructions on how you can upload your Android studio projects to GitHub:

## Step 1 - Sign Up GitHub and Install Git
- Sign up  [github.com](https://github.com/) 
- Download and install git from  [here](https://git-scm.com/downloads) 

## Step 2 - Enable Version Control Integration
- In your Android Studio, go to menu "**VCS→Enable Version Control Integration...**"
![android_studio_share_to_github_01.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632532935222/844EiPo3r.png)

- Select "**Git**" and click "**OK**"
![android_studio_share_to_github_02.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632533038400/7uPs8DL1I.png)

**Update: Feb 8, 2022:** I learned that the `.idea` folder is unnecessary to be committed to repository because those files are specific to IDE configurations, which could be different per developer. In this case, you can update the `.gitignore` file to exclude them. 

- Update `.gitignore` to ignore the entire `.idea` folder (optional step)

In your root project folder, you should see `.gitignore` which have the following default ignore for certain files and folders in the `.idea` folder.

Replace these
```
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
```
With

```
/.idea
```
To ignore the entire `.idea` folder instead.

## Step 3 - Share Project on GitHub
- Go to menu "**Git→GitHub→Share Project on GitHub**"
![android_studio_share_to_github_03.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632533291532/2wG10u4gI.png)

- Login GitHub account either via GitHub website or with token. GitHub website login didn't work for me. So I ended up use token instead.
![android_studio_share_to_github_04.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632534611765/1Aq5GYLJB.png)

- Click "**Generate...**" and follow the instructions to get the generated token
- Copy and paste the token, click "**Add  Account**"
![android_studio_share_to_github_05.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632534815574/aIIoJ2pHP.png)

- Name your repository name, check "**Private**" if you want to create a private repository. Then, click "**Share**". A new repository is created.
![android_studio_share_to_github_06.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632534997903/MR1dF88w0.png)

- Click "**Add**" to commit your files
![android_studio_share_to_github_07.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632535239726/BHlwBAJMB.png)


That is it. Your project now has been uploaded to your GitHub repository. After you make some local changes to your file, you need to commit and push those changes into a GitHub repository. The following steps show you how to do that.


# Make Changes to Your Files

## Step 1 - Commit your files
- Click "**commit**" in the top right corner. You can also go to menu "**Git→Commit**"
![android_studio_share_to_github_08.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632535743452/XKIURdRnx.png)

## Step 2 - Push your files
- Enter your commit description and click "**Commit and Push...**"
![android_studio_share_to_github_09.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632535845009/uiBS0TUxA.png)

- There are code analysis warnings, you can either review them or just go ahead to push your files
![android_studio_share_to_github_10.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632536252224/8d2XNfwPih.png)

- Click "**Push**". Your files have been updated in the repository
![android_studio_share_to_github_11.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632536379936/gUSfMsbBP.png)

- You can also click "**Commit**" and push your files later on. To push your files, click "**push**" in the top right corner. You can also go to menu "**Git→Push**". The rest of the steps are very similar to "**Commit and Push**" above.
![android_studio_share_to_github_12.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632536584424/W-ACaRmKN.png)

Another common thing I do before I commit the files is review my changes. The following steps show you how you can review and make any changes to your files in the committing screen.


# Show Diff Before Commit

## Step 1 - Show Diff
- Select a file, right click and click "**Show Diff**"
![android_studio_share_to_github_13.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632791558829/u-axyhnk4.png)

## Step 2 - Select "step-by-step viewer"
- By default, it is "**Unified viewer**" which I don't like.
![android_studio_share_to_github_14.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632791856741/QVRxY8pRU.png)

## Step 3 - Review and Make Changes
- Now you can review your change. You can also make changes to your file from this window.
![android_studio_share_to_github_15.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1632792129491/bJDEysCx3.png)

Hope this helps! I’m new to GitHub and this is what I do to commit and push my Android projects into my GitHub repositories.

---

*Originally published at [https://vtsen.hashnode.dev](https://vtsen.hashnode.dev/how-to-upload-android-studio-project-to-github)*.