Restore remote options to <modules/subworkflows> remove command
### Description of the bug

Recent updates to <modules/subworkflows> remove got rid of the remote options for the command. 
This has caused it to be impossible to remove non-nf-core components via the command. 

### Command used and terminal output

```console
nf-core modules --git-remote <my-git-url> remove

Pulling from 'nf-core/modules' (https://github.com/nf-core/modules.git)
CRITICAL Nothing installed from nf-core/modules in pipeline
```


### System information

_No response_
diff --git a/nf_core/__main__.py b/nf_core/__main__.py
index 3d181d83..47c6e993 100644
--- a/nf_core/__main__.py
+++ b/nf_core/__main__.py
@@ -636,7 +636,12 @@ def remove(ctx, dir, tool):
     Remove a module from a pipeline.
     """
     try:
-        module_remove = nf_core.modules.ModuleRemove(dir)
+        module_remove = nf_core.modules.ModuleRemove(
+            dir,
+            ctx.obj["modules_repo_url"],
+            ctx.obj["modules_repo_branch"],
+            ctx.obj["modules_repo_no_pull"],
+        )
         module_remove.remove(tool)
     except (UserWarning, LookupError) as e:
         log.critical(e)
@@ -1194,7 +1199,12 @@ def remove(ctx, dir, subworkflow):
     Remove a subworkflow from a pipeline.
     """
     try:
-        module_remove = nf_core.subworkflows.SubworkflowRemove(dir)
+        module_remove = nf_core.subworkflows.SubworkflowRemove(
+            dir,
+            ctx.obj["modules_repo_url"],
+            ctx.obj["modules_repo_branch"],
+            ctx.obj["modules_repo_no_pull"],
+        )
         module_remove.remove(subworkflow)
     except (UserWarning, LookupError) as e:
         log.critical(e)
diff --git a/nf_core/components/remove.py b/nf_core/components/remove.py
index 2215d8e8..694b793b 100644
--- a/nf_core/components/remove.py
+++ b/nf_core/components/remove.py
@@ -16,8 +16,8 @@ log = logging.getLogger(__name__)
 
 
 class ComponentRemove(ComponentCommand):
-    def __init__(self, component_type, pipeline_dir):
-        super().__init__(component_type, pipeline_dir)
+    def __init__(self, component_type, pipeline_dir, remote_url=None, branch=None, no_pull=False):
+        super().__init__(component_type, pipeline_dir, remote_url, branch, no_pull)
 
     def remove(self, component, force=False):
         """
diff --git a/nf_core/modules/modules_json.py b/nf_core/modules/modules_json.py
index f3fc1922..2227a989 100644
--- a/nf_core/modules/modules_json.py
+++ b/nf_core/modules/modules_json.py
@@ -685,6 +685,8 @@ class ModulesJson:
                         self.modules_json["repos"][repo_url][component_type][install_dir].pop(name)
                         if len(repo_entry[component_type][install_dir]) == 0:
                             self.modules_json["repos"][repo_url].pop(component_type)
+                            if len(repo_entry) == 0:
+                                self.modules_json["repos"].pop(repo_url)
                         # write the updated modules.json file
                         self.dump()
                         return True
diff --git a/nf_core/modules/remove.py b/nf_core/modules/remove.py
index 72c94927..33d9f62d 100644
--- a/nf_core/modules/remove.py
+++ b/nf_core/modules/remove.py
@@ -6,5 +6,5 @@ log = logging.getLogger(__name__)
 
 
 class ModuleRemove(ComponentRemove):
-    def __init__(self, pipeline_dir):
-        super().__init__("modules", pipeline_dir)
+    def __init__(self, pipeline_dir, remote_url=None, branch=None, no_pull=False):
+        super().__init__("modules", pipeline_dir, remote_url=remote_url, branch=branch, no_pull=no_pull)
diff --git a/nf_core/subworkflows/remove.py b/nf_core/subworkflows/remove.py
index fcd54095..bfe61a87 100644
--- a/nf_core/subworkflows/remove.py
+++ b/nf_core/subworkflows/remove.py
@@ -6,5 +6,5 @@ log = logging.getLogger(__name__)
 
 
 class SubworkflowRemove(ComponentRemove):
-    def __init__(self, pipeline_dir):
-        super().__init__("subworkflows", pipeline_dir)
+    def __init__(self, pipeline_dir, remote_url=None, branch=None, no_pull=False):
+        super().__init__("subworkflows", pipeline_dir, remote_url=remote_url, branch=branch, no_pull=no_pull)
diff --git a/tests/modules/remove.py b/tests/modules/remove.py
index 5e62863b..b343a02d 100644
--- a/tests/modules/remove.py
+++ b/tests/modules/remove.py
@@ -14,10 +14,9 @@ def test_modules_remove_trimgalore_uninstalled(self):
     assert self.mods_remove.remove("trimgalore") is False
 
 
-# TODO Remove comments once external repository to have same structure as nf-core/modules
-# def test_modules_remove_trimgalore_alternative_source(self):
-#     """Test removing TrimGalore! module after installing it from an alternative source"""
-#     self.mods_install_alt.install("trimgalore")
-#     module_path = os.path.join(self.mods_install.dir, "modules", "external", "trimgalore")
-#     assert self.mods_remove_alt.remove("trimgalore")
-#     assert os.path.exists(module_path) is False
+def test_modules_remove_multiqc_from_gitlab(self):
+    """Test removing multiqc module after installing it from an alternative source"""
+    self.mods_install_gitlab.install("multiqc")
+    module_path = os.path.join(self.mods_install_gitlab.dir, "modules", "nf-core", "multiqc")
+    assert self.mods_remove_gitlab.remove("multiqc", force=True)
+    assert os.path.exists(module_path) is False
diff --git a/tests/test_modules.py b/tests/test_modules.py
index 847c8237..1678d9e6 100644
--- a/tests/test_modules.py
+++ b/tests/test_modules.py
@@ -95,7 +95,11 @@ class TestModules(unittest.TestCase):
 
         # Set up remove objects
         self.mods_remove = nf_core.modules.ModuleRemove(self.pipeline_dir)
-        self.mods_remove_alt = nf_core.modules.ModuleRemove(self.pipeline_dir)
+        self.mods_remove_gitlab = nf_core.modules.ModuleRemove(
+            self.pipeline_dir,
+            remote_url=GITLAB_URL,
+            branch=GITLAB_DEFAULT_BRANCH,
+        )
 
         # Set up the nf-core/modules repo dummy
         self.nfcore_modules = create_modules_repo_dummy(self.tmp_dir)
@@ -195,6 +199,7 @@ class TestModules(unittest.TestCase):
         test_create_patch_update_success,
     )
     from .modules.remove import (
+        test_modules_remove_multiqc_from_gitlab,
         test_modules_remove_trimgalore,
         test_modules_remove_trimgalore_uninstalled,
     )
['nf_core/subworkflows/remove.py', 'nf_core/components/remove.py', 'nf_core/__main__.py', 'nf_core/modules/remove.py', 'tests/test_modules.py', 'tests/modules/remove.py', 'nf_core/modules/modules_json.py']