diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
index 24aa4853c0317e5d39ae3fc7eed1f8f9ae9b201c_aGdleHQvbGZzL19faW5pdF9fLnB5..a8c778b2a689678931d21b67ab0119b551bad3d2_aGdleHQvbGZzL19faW5pdF9fLnB5 100644
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -153,6 +153,7 @@
     )
 
     wrapfunction(hg, 'clone', wrapper.hgclone)
+    wrapfunction(hg, 'postshare', wrapper.hgpostshare)
 
     # Make bundle choose changegroup3 instead of changegroup2. This affects
     # "hg bundle" command. Note: it does not cover all bundle formats like
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
index 24aa4853c0317e5d39ae3fc7eed1f8f9ae9b201c_aGdleHQvbGZzL3dyYXBwZXIucHk=..a8c778b2a689678931d21b67ab0119b551bad3d2_aGdleHQvbGZzL3dyYXBwZXIucHk= 100644
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -221,6 +221,14 @@
 
     return result
 
+def hgpostshare(orig, sourcerepo, destrepo, bookmarks=True, defaultpath=None):
+    orig(sourcerepo, destrepo, bookmarks, defaultpath)
+
+    # If lfs is required for this repo, permanently enable it locally
+    if 'lfs' in destrepo.requirements:
+        with destrepo.vfs('hgrc', 'a', text=True) as fp:
+            fp.write('\n[extensions]\nlfs=\n')
+
 def _canskipupload(repo):
     # if remotestore is a null store, upload is a no-op and can be skipped
     return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote)
diff --git a/tests/test-lfs.t b/tests/test-lfs.t
index 24aa4853c0317e5d39ae3fc7eed1f8f9ae9b201c_dGVzdHMvdGVzdC1sZnMudA==..a8c778b2a689678931d21b67ab0119b551bad3d2_dGVzdHMvdGVzdC1sZnMudA== 100644
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -208,6 +208,12 @@
 
   $ cd ..
 
+  $ hg --config extensions.share= share repo7 sharedrepo
+  updating working directory
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg -R sharedrepo config extensions --debug | grep lfs
+  $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob)
+
 # Test rename and status
 
   $ hg init repo8