Using bitbucket with Magento 2

Bitbucket is an alternative of git which is also free. You can create your private repository for free. In this tutorial we will see how to start with bitbucket and how we can use bitbucket for managing magento 2 code.

How to start with bitbucket

Step 1: Create an account with Bitbucket and create one repository. Once you create a repository then you will get repository url from there.
Step 2: Setup project on your local store
i) Run below command if you want to download source code from repository to your machine

cd --Your local directory
git init .
git remote add origin <repository-url>
git pull origin master

ii) Run below command to create local copy of workspace

git clone –REPOSITORY-URL—
git add  .
git commit -m “initial version of core commit”

Step 3:Once you committed your core code in git. Its time to test your core code if its really working to do that

  1. we need to clone it to another folder like git clone https://[email protected]/cutehits/m2demo-core.git try to see what is the difference between your running code and this committed code (we already know that there are several files we have ignored).. Create a list of files which we have created and copy it.
  2. Get committed code on your local and use composer update (make sure sample data is not there—if you see any memory error)
    1. Now go to command line and run the command php bin/magento setup:upgrade (this will update db schema if any)
    2. Change the site path under DB. Modify unsecure and secure db url under core_config_data
  • Flush magento cache from command line: php bin/magento cache:clean

Step 4 In case you need to delete any folder/file try command as below:-
Steps to remove directory and commit folder

git rm -r --cached FolderName
git commit -m "Removed folder from repository"
git push origin master

Step 5The same way we can configure a phpmyadmin and import and export to dev machine whenever its required.

fatal: The remote end hung up unexpectedly

In case you get error “fatal: The remote end hung up unexpectedly”
then run the command

git config –global http.postBuffer 104857600

See all branches of git repo after clone

Git branch -a

How to clear cache of composer

Sometimes you deleted any module from composer.phar file and still its being used so it means its showing from cache. You should clear your cache for same purpose.

composer clearcache
The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...