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://cutehits@bitbucket.org/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

Related posts:

The following two tabs change content below.

Chandra Shekhar

Consultant at Infogain
Chandra Shekhar is a LAMP Developer,Thinker,Blogger and currently working as Magento(Ecommerce) specialist.. I am always open to learn new things in LAMP as well as other newer technology. In the journey of my last 9 years of web and product development, I have decided to share my knowledge and experience to Open Source Community in 2011. In this regard I have started CuteHits.com. Since then I am actively sharing my knowledge on various LAMP technology through CuteHits.com’s technical ... Read More about Chandra Shekhar