Git is a distributed revision control and source code management system with an emphasis on speed. It is a free software distributed under the terms of the GNU General Public License version 2.

This article explains how to use BitBucket in creating branches, git repository.

Index

  • Configuring Repository
  • Using Git from local
  • Cloning

1.Configuring Repository

Step1 : Log in to Bitbucket by using the log details

Fig 1.1: Shows screen after login into Bitbucket

Step 2: Create one repository for the project as ktree_symphony

Fig 1.2: Shows screen to create repository

2. Using Git from local

To access main repository install git in local and follow the below command to push the files to repository First generate the ssh keys in the system place it in /root/.ssh/id_rsa and /root/.ssh/id_rsa.pub

Step1: copy the id_rsa.pub content and paste in Bitbucket

Fig 2.1: Shows screen for account management

 

Fig 2.2: Shows Screen to add SSH keys

Step 2 : Enter following commands to commit and push to repository

#cd /path/to/your/project
#git init
#git remote add origin git@bitbucket.org:edithsanford/teamedith-symfony-php.git
#git add –all
#git commit -m “Initial commit by KTree”
#git push -u origin master

Now code is pushed to Bitbucket with branch name master.

Fig 2.3: Shows Screen view of master branch

Step 3 :Create another branch with name development.

Enter below commands to create.
#cd /path to project directory
#git branch developer
#git checkout developer
#git add –all
#git commit -am "committing files to developer branch"
#git push

Now developer branch created in Bitbucket with the master files

Fig 2.4: Show screen of developer branch, created in Bitbucket with the master files

3. Cloning

Cloning developer branch to developer system.
Open the terminal and install git in developer system.

#mkdir /path/to/your/project
#cd /path/to/your/project
#git init
#git clone -b developer git@bitbucket.org:edithsanford/teamedith-symfony-php.git
All the code from developer branch will now check out to local developer server..