How to create github repository from android studio without using command line ?


Hi guys in this tutorial we will see how to create a github repository from Android Studio. For this purpose we will not be using command line or the web browser.

It significantly reduces the hassle and also saves a lot of time since we won't be spending much time on writing the commands or be going to the github website to create new repository. All the hassles will be handled by android studio.

So Android Studio will help us in creating the repository, adding all the files for commit, commit the files to be pushed and finally push the project to the github repository created.

Before you begin :

1) Download and install git if you haven't already done.
for mac OS : https://git-scm.com/download/mac
for windows : https://git-scm.com/download/win

2) go here and create a github account >> https://github.com/

Now follow the below steps to create a github repository in the above created account from android studio :

1) First of all open up android studio and create a brand new android studio project. Once the project has finished the building process, goto the VCS option on the top menu as shown below

VCS option appears in the top menu

2) From the above VCS option navigate VCS > Import into version control > Share project on Github like shown in the image below

Share project on Github
3) Now we will be asked to login with your github credentials before sharing the project on github. We will be required to perform this only once since we will be generating an API token during our first login and then will be using this saved token value to login further. So first of all click on "Create API token" to generate one.

Click on "Create API Token"
4) When "Create API Token" is clicked, it will bring up the following screen to login into github. Enter the credentials for github and click login, it will generate the API Token like shown below.

Login here with github credentilas
Generates token on successfully login

5) In the above login screen click the checkbox "Save Credentials" so that we won't have to do this process each time we try create a repository. Now click on login button again. You will be successfully logged in and taken to the following screen
Entering repository details
As shown above you will be prompted to enter a name and description for your repository, keep the remote name as remote. You can also make your repository private, which was earlier a paid feature in github. Now click on share button.

6) As soon as we hit share button, we will be asked what all files are needed to be added to git, since this is our first commit we can select all files like shown below, doing which will make all your files ready for commit

Initial commit to git

As shown above select all files (already selected by default) and enter a commit message. Now click OK button. As soon as we hit OK button we can see that all the files get committed and finally pushed to the remote github repository, you will also be presented with a link to your repository at the bottom of android studio like shown below

Github repository created
Click on the link shown in the image above and you will be taken to your repository in gihub like shown below

Github repository opened in browser


No comments:

Post a Comment