How to clone a GitHub project on Android Studio
Learn how to build a REST API: Build a Backend REST API with Python & Django – Advanced
You may have read/watched my previous tutorial How to use GitHub with Android Studio 1.x. This is a follow up tutorial which explains how to clone a project that has been added to GitHub.
Prefer a video?
Let’s dive right into it.
Part 1: Cloning the Project
Step 1 – Load Android Studio and select Check out project from Version Control
Step 2 – Select GitHub from the drop down list
Step 3 – Enter your GitHub credentials. Then click Login
Step 4 – Fill out the Clone Repository form and click Clone
Fill out the following items:
- Vcs Repository URL: The URL of your repository on GitHub
- Parent Directory: The local directory where you want to store this project
- Directory Name: The name of your project
Step 5 – Open the project
You will be prompted with a message asking you would like to open the project in Android Studio. Click Yes.
The project will now open in Android Studio:
Part 2: Committing Changes to GitHub
Now that we have checked out and opened the project, this next part explains how to commit changes.
Step 1 – Enable Version Control Integration
From the top bar select VCS > Enable Version Control Integration
Then select Git from the dropdown box
Step 2 – Make a change to the project
Make any change, for the purpose of this tutorial I simply modified the strings.xml file to change the “Hello World!” text to read “Hello London App Developer!”.
Step 3 – Commit the change
On the top right hand side of Android Studio, right click the project name, select git and choose Commit Directory
In the Commit Changes screen, ensure all the files are checked and type a Commit Message. Then click Commit to commit your changes.
Next you will see the below message:
Step 4 – Push your changes to GitHub
Next, select the project name in the top left corner, then choose Git > Repository > Push.
When you see the Git Push screen, click Push.
If this works, you will see the Push successful message.
If you login to Git and browse to your repository, you will see that the changes have been pushed.
Thanks for reading. I hope you found this help? If you have any questions please let me know in the comments below.
Cheers,
Mark
Learn how to build a REST API: Build a Backend REST API with Python & Django – Advanced
I’m getting an error and it says it cannot find the file specified
i am getting an error like that file cannot resolve affollested alert material. i just want to pull that from git to studio.
Thanks a lot! It works!
Very good tutorial, That is work for me, Thanks.
Hi Mark,
In the VCS Repository URL: https://www.github.com/username/projectname
Instead of that, can I write: file:///myservername/folder1/folder2/projectname
if I am using another computer as my server instead of github.com server.
Also, is this “file:///myservername/folder1/folder2/projectname” the correct way to write VSC Repo URL. I am stuck. Please let me know
Can you guide me to the link where you show when not to push to master branch?
Also there was a button for pull right above push. When and where would we use that?