diff --git a/dvc/external_repo.py b/dvc/external_repo.py index 026c5bb13..3f55f128a 100644 --- a/dvc/external_repo.py +++ b/dvc/external_repo.py @@ -68,9 +68,8 @@ def _external_repo(url=None, rev=None, cache_dir=None): _git_checkout(new_path, rev) repo = Repo(new_path) - original_repo = None try: - # check if the URL is local and no default remote + # check if the URL is local and no default remote is present # add default remote pointing to the original repo's cache location if os.path.isdir(url): rconfig = RemoteConfig(repo.config) @@ -81,8 +80,6 @@ def _external_repo(url=None, rev=None, cache_dir=None): default=True, level=Config.LEVEL_LOCAL, ) - repo.scm.add([repo.config.config_file]) - repo.scm.commit("add remote") if cache_dir is not None: cache_config = CacheConfig(repo.config) @@ -90,8 +87,6 @@ def _external_repo(url=None, rev=None, cache_dir=None): finally: # Need to close/reopen repo to force config reread repo.close() - if original_repo: - original_repo.close() REPO_CACHE[key] = new_path return new_path