Create a full clone of a Frappe app locally (for development)

Synthesized from several helpful StackOverflow responses and some trial and error.
This is intended for use in a development or possibly staging environment. The CloudStorage app (docs) is used as an example here, but this technique can be used with any Frappe app, though full clones of Frappe or ERPNext will be very large.

bench get-app cloud_storage git@github.com:agritheory/cloud_storage.git --skip-assets

This will complete the default clone/install (but not build) of a Frappe app.

Let’s confirm what we’re working with is a shallow clone with only the latest commit on the default branch.

cd apps/cloud_storage
git branch
# version-14

Time for surgery. Remove the existing shallow clone folder from the app’s folder,

# ~/frappe-bench/apps/cloud_storage
rm -rf .git
git clone --mirror git@github.com:agritheory/cloud_storage.git .git
git config --unset core.bare
git config receive.denyCurrentBranch updateInstead
git config --unset remote.origin.mirror
git reset --hard

Confirm this worked

# now test
# should show all branches from remote
git log 
# should show full commit history on default branch

Since this is focused on a development environment, it is appropriate to rename the remote from ‘upstream’ to ‘origin’.

git remote rename upstream origin

Updates to this guide will be maintained here

5 Likes