Push a new Android Studio project to a GitHub repository using Git and a personal access token. It suits beginners who have a project open in Android Studio and a GitHub account. You need Git installed and an internet connection.
YouTube video: How to upload an Android Studio project to GitHub | 2023
Caption availability is unknown. Check the CC control in the YouTube player.
Choose a chapter (9)
- Video length
- 5 min 36 s
- Time to do it
- 20 minutes
- Difficulty
- Medium
- Steps
- 8
What you need
Steps
Open a terminal and run git --version to check if Git is installed. If you see a version number, skip the install step.
Download Git from git-scm.com and run the installer if Git is missing. Keep the default options and finish the setup.
In Android Studio, open Settings, go to Version Control, then Git, and confirm the Git executable path is filled in. Click Test to check it works.
On GitHub, click New repository, give it a name, and leave it empty without a README. Copy the repository URL.
In Android Studio, go to VCS, then Enable Version Control Integration, and choose Git.
Open Git, then Manage Remotes, click the plus button, paste the repository URL, and save it as origin.
On GitHub, open Settings, Developer settings, Personal access tokens, and generate a token with repo scope. Copy it now.
Commit your files with VCS, then Commit, then push with Git, then Push. Enter your GitHub username and the token as the password when asked.
Tips and common mistakes
Store the personal access token somewhere safe, because GitHub shows it only once.
Never paste the token into a public file or commit it to the repository.
If the push is rejected, check that the remote URL ends in.git and matches your repository.
Questions
Why does GitHub ask for a token instead of my password?
GitHub stopped accepting account passwords for Git operations. A personal access token works as the password.
Can I use SSH instead of a token?
Yes. Add an SSH key to your GitHub account and set the remote URL to the SSH address instead.
Do I need to create the repository on GitHub first?
Yes. Create an empty repository on GitHub, then add its URL as the remote in Android Studio.
The notes are drafted automatically from video details and general task knowledge. How the guide was prepared
Report a correction


