Tuesday, December 2, 2014

Setting up Git and TortoiseGit with Bitbucket in Windows

This article is targeted to those who has already been familiar with Git, TortoiseGit and Bitbucket. And therefore the details of these artifacts are not mentioned here. However, if you are not familiar with these then please go through the below links for the details on these, which is itself recommended for this article.

URLs:

Git :- http://git-scm.com
TortoiseGit :- https://code.google.com/p/tortoisegit
Bitbucket :- https://bitbucket.org

Actually, I was able to install Git and TortoiseGit on my Windows and also had created a single user account on Bitbucket. But I could not find the way to integrate the TortoiseGit (Windows Shell Interface) with my Bitbucket account. In my opinion, it is inappropriate to use Git Bash (CLI, Command Line Interface) to push, pull, commit the files on BitBucket. Therefore I was searching for the UI mechanism for this where I found an interface, TortoiseGit.

Here are the steps what I found to work with:



I have assumed that you've already installed Git and TortoiseGit on your machine and have created bitbucket account:

FIRST STEPS:

1. Create a new repository on your Bitbucket account. For example see the screenshot below where I have created a repo named Prof-Services:
2. Create a bitbucket folder into your local machine (folder name and drive location is up to you).
3. Now move into the bitbucket account and select the repository name (i.e. Prof-Services) that you've created recently.
4. Then click on the Clone link on the left bar where you will be provided the clone command of your bitbucket repository, as shown below.
[Everything you are going to work is inside this clone folder of your local machine. And you will push it into your main server, bitbucket repository, after you are done on your clone.]

5. Copy this clone command and move into the local machine where you've created bitbucket folder recently.
6. Right click the bitbucket folder and select the Git Bash as shown below.
[You'll then see a Git Bash interface pointing the bitbucket folder.]
7. Now, paste the command you copied from Bitbucket onto the Git bash command line and press Enter. Below are the instructions to do this.
8. Now Git will ask you for the repository password which is the password password that you entered when you created your Bitbucket account.
9. Your clone is ready now. Your bitbucket repo is cloned in your local machine.

SECOND STEPS:

1. Move your working project into your clone folder. For example let's say Wordpress project, as shown below.
2. Right click the project folder and go through TortoiseGit and click Add as shown below.
3. You will prompt below dialogue box and check the select all option then click OK.
4. Your files will get push into your clone repository and below Finished prompt will appear. Then click on the commit button.
5. Then type the commit message as shown like below and click OK.
6. Finally you will be prompted the below completion dialogue box where you can either close the prompt box or click the push button to push your recently added clone project into main bitbucket repository. You will be asked for server password of your repository after you click the push button for moving your files to your respective repository. Once you give the password your files will get pushed to the server.
7. Go to your bitbucket account and go to your recently created repository (i.e. Prof-Services). You will see the wordpress project that you have pushed to this server recently as shown below.
8. Please note that like mentioned in the steps#6 you do not need to push your files into your bitbucket repository instantly. You can push that later after you think you are done by following process. [right click on project file inside your clone and go through TortoiseGit and click Push and follow same process as done at last in steps#6]

No comments:

Post a Comment