Thursday, April 30, 2015

Using GIT with Android Studio on windows with terminal or toolbar

Today We are going to learn how we can create a git repository using android studio.
Android Studio Makes it very simple just follow the below steps and your project is on git :
First we setup our PC ::

Download git from :http://git-scm.com/download/win

install it.

for git repository online I am using Bitbucket  , bitbucket allow us to host private repository free you can also use github but your project should be public if you want to use it free.

Here I am going to use bitbucket:
Create repository
After creating repository  you will see screen like this


Now open AndroidStudio Create new project.
after creating the project clcik on VCS on menu strip  and enable git as shown below

Now your project git enabled ;
You can see terminal in andoid studio we can use it for git commands.
Now check terminal and write git status if it  give you below message :
'git' is not recognized as an internal or external command, operable program or batch file.
then you have to follow below steps (from Stackoverflow):

  • right-click "My Computer",
  • select "Properties",
  • open "Advanced",
  • click "Environment Variables",
  • highlight the "Path" variable,
  • click "Edit",
  • add your specific path to front of "Variable value" field, separated by a semicolon from the existing entry. Do not add a space between ; and last entry
Now your terminal should work with git command.

You have to put you remote address of your project   :

got to bitbucket page and get the link 






now you can use command or commit button in android studio to commit your project
 Now you can push your  changes to server. by git push -u origin master

you can refresh your bitbucket page and see your commits are there :)
Happy coding :)

No comments:

Post a Comment