Shopify Github Integration
title: Shopify Github Integration date: 2023-03-01 10:29 +1100 categories:hub and Shopify
Keep your live shopify website and local dev synced by using github. This sounds complicated and time consuming but its not. It takes minutes to do this and it makes your dev environment super organised.
Prerequisites
- Github repo for your shopify website
- shopify local dev environment
Important to note that there is no admin area on your local environment. the content from the live site is shared with the local.
Pull down your theme to get started
- Pull changes down to your local before doing your local development theme customisations
- This will ensure youve got the latest version of your theme.
shopify theme pull
This will overide any changes you have locally even if you have committed them.
1
shopify theme pull --store your-store.myshopify.com
Create your local Git Repo
Run the following commands to initiate alocal repo, and push to the remote.
1
2
3
4
5
6
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:example/shopify-repo.git
git push -u origin main
Connect Github Repo to Shopify Website
This is the easy part.
- Go to online store > themes > in the
add theme
toggle button choose add theme from github. - Follow the prompts to complete the connections
- In your theme library you will now see your theme from the github repo, it’s added as a non-published theme.
Preview and Publish your Github Theme
- Check its all good with a quick theme preview
- Publish if you see all the good things
Shopify is now connected to your repo
So now you can push changes to your theme through github. Furthermore, Shopify will also push any theme configuration updates you make to your repo too. its Important to keep your local repo upto date with these changes also. so remember to use git pull
before working on your local theme.
- Any changes made to your live site will be automatically pushed to your repo