The target of this post is to describe detailed steps on how to push your code from Android Studio into GitHub.
Version of Android Studio: 0.3.6
Version of Android Studio: 0.3.6
- Assuming that your code isn't under version control. So the first step is to add your source code to VCS (Version Control System) which is Git in my example. So you have to enable Version Control Integration in your project by pressing "VCS -> Enable Version Control Integration"
- Choose Git as your version control system as indicated here:
choose Git as your version control system - Now all of your files will be turned into Red color which means that they are not added to VCS yet as explained here
Non-versioned Files - Add all your project files to version control system as follows:
Add to VCS - Now all files should be turned into green color as explained here:
Files status change after adding to VCS - Files are ready to be committed to your local repository:
Commit to local repo - Prepare you commit message then press commit; In our example it is "Add initial code version"
Add commit message - You should a notification green window message as indicated below:
Commit Green Message - You are almost ready to commit but you have to apply recommendations of IntelliJ and ignoring some unnecessary files by adding them to .gitignore file. I will add any iws file inside .gitignore
Change gitignore file - Again add Commit message
Commit message for .gitignore - Assuming that you have a valid Git repository on GitHub, In our example it is https://github.com/Wael-Showair/test
- Download and install Source Tree application from the following website.
- In Source Tree program,
File -> Open
and navigate to your project folder. Don't forget to cancel bookmark creation as well. - In Source Tree program:
Repository -> Add Remote
, you should see Repository Settings windowopen remote repository in Source Tree - Fill in your GitHub repository fields as follows:
Fill in data of your remote repository - Back again to your Android Studio, Synchronize button (rounded blue arrows) then push your local repository to GitHub repository as follows:
push you code to GitHub repository - Choose the most updated commit comment then press push. Don't forget to tick below checkbox to push your code to specified branch. In our example I renamed it from "master" to "newBranch". You should have get a green text message indicating your successful commit into GitHub repository
Successful notification of repo push - Check your GitHub repository url, it should indicate you the code with the respective branch name that you specified
Enable VCS integration |