04 - Remote Repository - Bitbucket

 Remote Repository 

  • githup.com
  • bitbucket.com

1. First create an account bitbucket.com

2. Generate private and public key ( In local Centos VM )
  • ssh-keygen -t rsa
  • cd /root/ .ssh/
    • id_rsa.pub ** public key
    • id_rsa ** private key
  •  copy public key and go to bitbucket

3. Go to the bucket site
  • Click Settings -> SSH Key -->
  • Label: This is vm1 keys
  • Key: Past public key here

4. Create Repository
  • Click +
  • --> Repository
  • --> Project : devops batch
  • --> Repository name : infra-automation
  • --> Access level -> Private repository

5. Perform Push / Pull in local repository
  • git clone git@bitbucket.org:mali1969/infra-automation.git
  • git remote add origin git@bitbucket.org:mali1969/infra-automation.git
  • git pull origin master
  • git push origin master
  • git remote -v
               origin git@bitbucket.org:mali1969/infra-automation.git (fetch)
               origin git@bitbucket.org:mali1969/infra-automation.git (push)

6. Create Branching 
  • Branching is an integral part of any version control (VC) system.
  • Unlike other VC's Git does not create a copy of existing files for a new branch
  • It points to a snapshot of the changes you have made in the system
  • Create branch first in bitbucket
    • Click -> Branches -> Create Branch
    • Type: feature
    • Branch Name: feature/jira-123

7. How to change branch in local repository
  • git fetch && git checkout feature/jira-123
  • git branch

  •   * feature/jira-123
      master 
  • touch feature123.txt
  • git add feature123.txt 
  • git commit -m "jira-123 add new files"
  • git push origin feature/jira-123


8 - How to pull Request to add codes in Master
  • Developer create request 
  • -> Pull request
    • Create Pull Request
  • -> Admin to approval (  Merge and Decline request )
    • Merge
    • Decline

9 - How to change and delete branch
  • ** In local
  • git branch feature1
  • git checkout feature1
  • ** Create branch and checkout in command
  • git checkout -b feature2
  • touch feature2.txt
  • git commit -m "Added a feature 2 to code"
  • ** Merge Branch feature 1 with feature 2
  • git checkout feature1
  • git merge feature2
  • ls -ltr

10 - How to delete branching
  • git branch -d feature2
  • ** how to delete branch if not merge code with master
  • git checkout master
  • git branch -D feature1

Comments

  1. For add SSH Key,
    Login to bitbucket.org with your user name.
    Click on your profile icon (left bottom) --> Personal Setting.
    Under Security tab click SSH keys.--> Add key
    copy your rsa public key from your CentOS server and past under box and save it.

    ReplyDelete
  2. You need to add one more step after " How to pull Request, Merage and Decline", Approved or Decline Merage request

    ReplyDelete

Post a Comment

Popular posts from this blog

05 - Docker - Containers

08 - PUPPET - Configuration Management

06 - Docker Swarm - Container Orchestration