diff --git a/dvc/config.py b/dvc/config.py index 0fd312aa1..f509b9032 100644 --- a/dvc/config.py +++ b/dvc/config.py @@ -24,13 +24,21 @@ class ConfigError(DvcException): class NoRemoteError(ConfigError): - def __init__(self, command): - msg = ( - "no remote specified. Setup default remote with\n" - " dvc remote default \n" - "or use:\n" - " dvc {} -r \n".format(command) - ) + def __init__(self, command, *, has_any_remote=True): + if has_any_remote: + msg = ( + "no remote specified. Setup default remote with\n" + " dvc remote default \n" + "or use:\n" + " dvc {} -r ".format(command) + ) + else: + msg = ( + "no remote specified. Create a remote with\n" + " dvc remote add \n" + "To create a default remote use the -d flag:\n" + " dvc remote add -d \n" + ) super().__init__(msg) diff --git a/dvc/data_cloud.py b/dvc/data_cloud.py index fadd536bd..7f8c61150 100644 --- a/dvc/data_cloud.py +++ b/dvc/data_cloud.py @@ -39,7 +39,9 @@ class DataCloud(object): if remote: return self._init_remote(remote) - raise NoRemoteError(command) + has_any_remote = any(key.startswith("remote ") for key in self._config) + + raise NoRemoteError(command, has_any_remote=has_any_remote) def _init_remote(self, remote): return Remote(self.repo, name=remote)