diff --git a/git/remote.py b/git/remote.py index 9848624bf..0c9930778 100644 --- a/git/remote.py +++ b/git/remote.py @@ -644,7 +644,9 @@ def fetch(self, refspec=None, progress=None, **kwargs): :note: As fetch does not provide progress information to non-ttys, we cannot make it available here unfortunately as in the 'push' method.""" - self._assert_refspec() + if refspec is None: + # No argument refspec, then ensure the repo's config has a fetch refspec. + self._assert_refspec() kwargs = add_progress(kwargs, self.repo.git, progress) if isinstance(refspec, list): args = refspec @@ -666,7 +668,9 @@ def pull(self, refspec=None, progress=None, **kwargs): :param progress: see 'push' method :param kwargs: Additional arguments to be passed to git-pull :return: Please see 'fetch' method """ - self._assert_refspec() + if refspec is None: + # No argument refspec, then ensure the repo's config has a fetch refspec. + self._assert_refspec() kwargs = add_progress(kwargs, self.repo.git, progress) proc = self.repo.git.pull(self, refspec, with_stdout=False, as_process=True, v=True, **kwargs) res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())