Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions dvc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ def __init__(self, msg):


class NoRemoteError(ConfigError):
def __init__(self, command):
msg = (
"no remote specified. Setup default remote with\n"
" dvc remote default <name>\n"
"or use:\n"
" dvc {} -r <name>\n".format(command)
)

super().__init__(msg)
pass


def supported_cache_type(types):
Expand Down
21 changes: 20 additions & 1 deletion dvc/data_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,26 @@ def get_remote(self, remote=None, command="<command>"):
if remote:
return self._init_remote(remote)

raise NoRemoteError(command)
has_non_default_remote = bool(
self.repo.config.list_options(
Config.SECTION_REMOTE_REGEX, Config.SECTION_REMOTE_URL
)
)

if has_non_default_remote:
error_msg = (
"no remote specified. Setup default remote with\n"
" dvc remote default <remote name>\n"
"or use:\n"
" dvc {} -r <remote name>".format(command)
)
else:
error_msg = (
"no remote specified. Create a default remote with\n"
" dvc remote add -d <remote name> <remote url>"
)

raise NoRemoteError(error_msg)

def _init_remote(self, remote):
return Remote(self.repo, name=remote)
Expand Down