How do you synchronise projects to GitHub with Android Studio?
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
http://gitref.org/remotes/
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 the GIT Integration plugin
File (main menu) >> Settings >> Search for GitHub Integration
-
Enable Version Control Integration for The Project
VCS (main menu) >> Enable Version Control Integration >> Select GIT
-
Add project file to Local repository
Right Click on project >> GIT >> Add
-
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)
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.