Upload Project on GitHub From Android Studio

Nidhi Vanjare
3 min readOct 10, 2020

There are very few steps in which you can upload and keep updating your android projects to GitHub.

Prerequisite: A GitHub account and Git installed in your machine. (Install Git ).

You will need a GitHub account to upload your open source projects. You can create you free GitHub account. Once you have the account , in order to upload your project you have to CREATE A NEW REPOSITORY . You can do so by finding a plus sign at the corner for the screen once you have logged into GitHub.

After you have clicked “new repository” , a page like this will appear.

You have to name your repository and add description and README file if necessary. After you click Create repository , your new repository is created.

Now you open your Android Studio project that you have to upload to GitHub , and go to the terminal which is at the bottom corner.

In the terminal you have to add few commands in order to upload your project. When you are uploading your project for the first time , you have to initialize it to new or empty repository , you can do so by following commands.

> git init

Then you add all the files in the project and commit it to the repository. While committing the project files you can give a message so that you can bifurcate your commits later.

NOTE : When you first upload android project to Github for the very first time , the terminal will ask you your GitHub credentials.

> git add .

> git commit -m “commit message”

Now , you have to copy the link to your repository :

Now in the Android Studio terminal you have to centralises your source code to the other projects , you can do that by adding these commands

> git remote add origin <link to the repository>

> git remote -v

Now all that is left is to push. For your 1st commit you have do push using :

> git push origin master

Now you can go and check in your GitHub repository that the project is uploaded.

After your first commit in each project , you don’t have to follow all the steps again. You have to just add these commands:

IF GIT PUSH IS NOT WORKING YOU CAN TRY— — → git push -u origin — all

Thank You , Keep Coding !

--

--