Magento Repository Creation

Here’s a basic step-by-step guide for Magento Repository Creation:

  1. Login first on your Bitbucket.org account and click “Create” and click “Create Repository”.
  2. On the “Create a new repository” page
    • Set “Owner” to “yourusername”.
    • Enter the name of the “magento module” in the “Repository Name”.
    • Enter a small description about the “magento module” in “Description”.
    • “Access Level” should be set to “This is a private repository”.
    • “Forking” will be “Allow only private forks”.
    • “Project Management” can be left blank or use “Issue Tracking”
    • “Language” can also be left blank or can be set to what programming language is being used by the “magento module”. (ex: PHP).
    • Click “Create repository” button to create the new repository
  3. You will be then redirected to the page of the newly created empty repository.
  4. Next, you will need to clone the repo to your local machine, this can be achieved by clicking the “Clone” button on the left menu of the page. You can use either “SSH” or “HTTPS”
    • When using “SSH” for cloning the repository, you will need to add your “SSH Key” to your Bitbucket.org account. To achieved this:
      1. Using Ubuntu OS
        1. Browse to your “Home” folder
        2. Look for “.ssh” folder, if you can’t see any “.ssh”, try pressing “CRTL + H” to unhide hidden folders.
        3. Open “id_rsa.pub” and copy all the content of the file, that content is your “SSH Key”.
        4. Go back to your Bitbucket account and click your “Profile Avatar” on the top right and click “Settings” from the sub menu.
        5. On your “Accounts” page, click “SSH Keys” on the left menu.
        6. Click “Add Key” and enter “Label” for the new key (ex: WKS-200) and paste the “SSH Key” that you have copied earlier and hit “Add Key” to add the new “SSH Key” to your account.
        7. With this, you can clone the repo to your local machine without entering your Bitbucket account password.
    • When using “HTTPS” for cloning the repository, you will need to enter your Bitbucket account password every time you clone, commit, and pull from the desired repository.
  5. On this example we will be using “SSH” when cloning repository. Copy the command given when selecting “SSH” on the cloning option from “Step 4”.
    • Using Ubuntu OS and GIT on Terminal
      1. Open your “Terminal” and browse to your “apps” folder on your home folder, using this command: “cd ~/apps/”. If you don’t have an “apps” folder on your home folder, use this command to create the “apps” folder: “mkdir ~/apps/”
      2. Paste the command that you have copied from Bitbucket (ex: git clone git@bitbucket.org:yourusername/cart2quote-test.git) by using “CTRL + Shift + v” and hit enter.
      3. After cloning the repository, open the “magento module” and copy all the files and folder from it and paste it to the folder of your cloned repository.
      4. After copying the files to the repository folder, you will need to create a file name “composer.json” by using this template:composer.json
      5. Enter the name of the module in “name” and a small description in the “description” on the “composer.json” file.
      6. Next you will need to map all the files of the module in the “composer.json” file: (Image is an example of how you will map the files)
      7. Save the composer file and open your “Terminal” and browse to where the composer is found. Sample command: “cd ~/apps/NAME_OF_MODULE_FOLDER/”
      8. Run “composer validate” to make sure you have the correct commas in placed.
      9. On your “Terminal” run GIT command “git status” to list all files that needs to be added to the repo.
      10. Run GIT command “git add FILE/FOLDER NAME” to add untracked files to the repo.
      11. Run again GIT command “git status” to make sure that you have added all untracked files that needs to be added to the repo
      12. Run GIT command “git commit -m “MESSAGE”” to stage the files to be uploaded to the repo.
      13. Run GIT command “git push origin master” to push commit to repository server, where “master” is your branch name.
      14. Next adding a “tag” on the repo, run GIT command “git tag -a VERSION_OF_MODULE -m “MESSAGE”” to add a versioning of the module
      15. Run GIT command “git push origin TAG_VERSION” to push the “tag” version to the repository server.
      16. For re-adding the “tag”, first you need to delete the “tag” from the repository server, to achieve this, run GIT command “git tag -d TAG_VERSION_ON_THE_REPO”
      17. Run GIT command “git push origin :refs/tags/TAG_VERSION_ON_THE_REPO” to push deletion of “tag” to repository server
      18. And do again the steps “xiv” to “xv”.

And that’s it! If you have any questions about my process for Magento Repository Creation, leave a comment below. Good luck!

Jerome Rosal

Jerome Rosal

Jerome is Project Assistant’s code Yoda. He’s head developer and is often times referred to as “master” by the team of web devs he oversees. He’s the go-to guy for advice, and is “the man” for complex e-commerce builds. Jerome gets it done. The force is strong with Jerome. He’s the self-proclaimed night-shift office DJ and knows how to put a smile on everyone’s face with his hilarious playlists. But when he’s not knocking it out of the ballpark in the office, he kills in on the couch! He’s a huge movie buff and loves spending his time catching up on all the movies, series and animes he misses while hacking away at the office.