I am trying to synchronise a project that I have on in my Android Studio folder to GitHub, but I am not fully sure what to do other than adding my credentials in the options menu. Could someone give me a quick guide, please?
13 Answers
Open the project you want to push in Android Studio.
Click VCS -> Enable version Control Integration -> Git
There doesn't seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project and do git remote add <remote_name> <remote_url>
Now when you do VCS -> Commit changes -> Commit & Push
you should see your remote and everything should work through the GUI.
If you are getting the error: fatal: remote <remote_name> already exists
that means you already added it. To see your remotes do git remote -v
and git remote rm <remote_name>
to remove.
See these pages for details:
http://www.jetbrains.com/idea/webhelp/using-git-integration.html

- 4,487
- 1
- 16
- 17

- 3,807
- 1
- 17
- 8
-
4When i do VCS -> Commit changes i get **No changes detected** – TooCool Sep 22 '14 at 14:15
-
2If the file names in the project window are red that means they aren't being tracked. Right click the file then Git -> Add. Now changes in that file should be detected. – jsc0 Sep 24 '14 at 12:46
-
@jsc0 I think it can only add the `app` module at the maximum. To add all of them, open terminal and `git add .` at the project dir. Which one is the best practice? To add a project or to add a module into the version control? – fikr4n Dec 04 '14 at 03:00
-
1Can I push the same project to 2 github repo? I was not able to. – MysticMagicϡ Feb 05 '15 at 05:54
-
1I know of one way to add the remote through the GUI. If you do a push and you haven't set up credentials and the address for remote, then it will prompt you. You will see master -> Define remote and the "Define remote" part will appear as a link. Click on it and the rest will be self explanatory if you have used Git before. – Steven Eckhoff Apr 23 '15 at 03:17
-
2Great explanations. This video could also be helpful: https://www.youtube.com/watch?v=Ldmc757EXaE – Sam003 Jun 02 '15 at 19:26
-
Though not entirely related on this one, but in case you need your project to be on BitBucket altassian here's how you integrate bitbucket remote repo with Android Studio: http://www.goprogramming.space/connecting-android-studio-project-with-bitbucket/ – Neon Warge Dec 05 '15 at 05:41
-
`VCS -> Enable version Control Integration` doesn't exist for me. All I have in the VCS menu is VCS Operations, Apply Patch and Apply Patch from Clipboard. – Donald Duck May 11 '23 at 09:44
Following method is a generic way of pushing an Android Studio project to a GIT based repository solely using GUI.This has been tested with a GIT repository hosted in Visual Studio Online and should virtually work with GitHub or any other GIT based version control provider.
Note: If you are using GitHub 'Share on GitHub' is the easiest option as stated in other answers.
Enable Version Control Integration for The Project
VCS (main menu) >> Enable Version Control Integration >> Select GIT
Commit Added Files
Open the Version Control windows (Next to terminal window) >> Click commit button
In the prompt window select "commit and push"
Defining Remote
After analyzing code android studio will prompt to review or commit code when committed will be prompt to define the remote repository.There you can add the url to GIT repository.
Then enter the credentials for the repository and click 'Ok'.(Visual Studio online Users need to enable "alternate authentication credentials" as mentioned here to login to repository)

- 2,112
- 25
- 29
-
-
@Nepster you should be able to connect with a bitbucket repo. if you add the your bitbucket repo url at the step 5 in the answer. Also if you need a dedicate plugin please try https://bitbucket.org/atlassian/jetbrains-bitbucket-connector, but unfortunately it seems the plugin is not supported or updated according to JetBrains. – Deshan Mar 24 '18 at 13:34
On Android Studio 1.0.2 you only need to go VCS-> Import into Version control -> Share Project on GitHub.
Pop up will appear asking for the repo name.

- 27,862
- 20
- 113
- 121

- 491
- 4
- 3
-
When I try to do that, I get an error message saying, "Cannot run program "git.exe":CreateProcess error=2,The system cannot find the file specified." – Jarred Allen Oct 29 '16 at 16:07
-
-
1If you get the error above download latest git from https://git-scm.com/download/win and set the path to where you downloaded git.exe in Android Studio: File->Settings->Version Control->git "Path to Git executable" ; I had this issue hopefully will help others as well. – Sai Oct 18 '17 at 03:09
-
In the version of Android Studio I have (0.3.2), it was as easy as using the menu.
VCS Menu > Git > Share on GitHub.
It will then ask you for your credentials, and then a name for your new repo, and that's it!

- 311
- 2
- 8
-
In Android Studio 0.8.2 I found it via Alt+BackQuote or under VCS -> VCS Operations Popup. In this version of Android Studio I don't see Git under the VCS menu. If there's a plug-in or something I should have please let me know. – Robert Oschler Jul 13 '14 at 22:15
This isn't specific to Android Studio, but a generic behaviour with Intellij's IDEA.
Go to: Preferences > Version Control > GitHub
Also note that you don't need the github integration: the standard git functions should be enough (VCS > Git, Tool Windows > Changes)

- 3,146
- 1
- 24
- 45
Android Studio 3.0
I love how easy this is in Android Studio.
1. Enter your GitHub login info
In Android Studio go to File > Settings > Version Control > GitHub. Then enter your GitHub username and password. (You only have to do this step once. For future projects you can skip it.)
2. Share your project
With your Android Studio project open, go to VCS > Import into Version Control > Share Project on GitHub.
Then click Share and OK.
That's all!
For Android Studio 0.8.9: VCS --> Import into version contraol --> Share project on Github.
It doesn't give you option to share in a specific repository or at least I couldn't find (my limitation!).
You can add your github info here: File --> Settings --> Version COntraol --> Github.

- 1,834
- 22
- 36
Now you can do it like so (you do not need to go to github or open new directory from git):

- 10,654
- 2
- 52
- 51
First time I have added a video link for solving your problem but I learned it was a bad idea. This time I'll explain it briefly.
Android studio is compatible with github but you need adjust something:
- Setup Android Studio
Setup the Github plugins in the Android Studio settings
- Android Studio settings >> Plugins page
- Android Studio settings >> Plugins page
Download the git version control system from this link and setup https://git-scm.com/
- After the installation, open Android Studio settings page and select the git.exe
settings >> version control >> git
- Usually the path to git.exe is
program files >> git >> bin >> git.exe
- Go to
Settings >> Version control >> Github
you will see login and password for your Github account. Apply the settings. - For updating the project, go in Android Studio top line click
VCS >> enable version control integration >> git
- One more time
VCS >> import into version control >> share project on Github
and enter your master password.
Now you can use VCS update buttons for updating your project to Github

- 2,737
- 3
- 27
- 32

- 11
- 1
For existing project end existing repository with files:
git init
git remote add origin <.git>
git checkout -b master
git branch --set-upstream-to=origin/master master
git pull --allow-unrelated-histories

- 2,221
- 1
- 29
- 35
In Android Studio 0.8.2 , you have the same option (ie Share on GitHub). If you want to find it, you can use ctrl+shift+a and enter github in the input text.

- 11
- 1
Github with android studio
/*For New - Run these command in terminal*/
echo "# Your Repository" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/username/repository.git
git push -u origin master
/*For Exist - Run these command in terminal*/
git remote add origin https://github.com/username/repository.git
git push -u origin master
//git push -f origin master
//git push origin master --force
/*For Update - Run these command in terminal*/
git add .
git commit -m "your message"
git push

- 1,969
- 17
- 17
This is how I got mine working using Android Studio UI:
Delete .git folder from your project folder. Delete .git folder from all your project subfolders.
Open project in Android Studio.
Settings, Version Control, remove all the roots
Go to VCS, Import into VC, Create git repository
Select the directory
Make sure your folder is the only root in Settings, Version Control
Go to VCS, Import into VC, Share project on Github
Mark as private if wanted.
Select all the files for initial commit, including app folder
Add files, select all in your project folder and app folder.
VCS > Commit -> to commit the files.
VCS > Git > Push -> to push the files.

- 48,840
- 22
- 240
- 204