diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,11 @@
 
 ## WIP
 
+## [0.2.5] - 2020-11-14
+
+- Pass `--heads --tags` to `git ls-remote` to avoid fetching remote
+  refs. Don't pass when the revision begins with `refs`
+
 ## [0.2.4] - 2020-11-11
 
 - Add --dry-run option
diff --git a/package.yaml b/package.yaml
--- a/package.yaml
+++ b/package.yaml
@@ -1,5 +1,5 @@
 name: update-nix-fetchgit
-version: "0.2.4"
+version: "0.2.5"
 synopsis: A program to update fetchgit values in Nix expressions
 description: |
   This command-line utility is meant to be used by people maintaining Nix
diff --git a/src/Update/Nix/FetchGit/Prefetch.hs b/src/Update/Nix/FetchGit/Prefetch.hs
--- a/src/Update/Nix/FetchGit/Prefetch.hs
+++ b/src/Update/Nix/FetchGit/Prefetch.hs
@@ -103,16 +103,23 @@
                       | otherwise -> pure hash
     Nothing -> refute1 $ NoSuchRef (unRevision revision)
 
--- | Run git ls-remote --sort=-v:refname and return the first match if any
+-- | Run git ls-remote --heads --tags --sort=-v:refname and return the first
+-- match if any. Use '--heads --tags' if the revision doesn't start with
+-- 'refs/' to avoid getting 'remote' refs.
 gitLsRemotes :: Text -> Revision -> M (Maybe (Text, Text))
 gitLsRemotes repo revision = do
+  let headsTags = if T.isPrefixOf "refs/" (unRevision revision)
+        then []
+        else ["--heads", "--tags"]
   (exitCode, nsStdout, nsStderr) <- liftIO $ readProcessWithExitCode
     "git"
-    [ "ls-remote"
-    , "--sort=-v:refname"
-    , T.unpack repo
-    , T.unpack (unRevision revision)
-    ]
+    (  [ "ls-remote"
+       , "--sort=-v:refname"
+       , T.unpack repo
+       , T.unpack (unRevision revision)
+       ]
+    <> headsTags
+    )
     ""
   case exitCode of
     ExitFailure e -> refute1 (NixPrefetchGitFailed e (pack nsStderr))
diff --git a/update-nix-fetchgit.cabal b/update-nix-fetchgit.cabal
--- a/update-nix-fetchgit.cabal
+++ b/update-nix-fetchgit.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           update-nix-fetchgit
-version:        0.2.4
+version:        0.2.5
 synopsis:       A program to update fetchgit values in Nix expressions
 description:    This command-line utility is meant to be used by people maintaining Nix
                 expressions that fetch files from Git repositories. It automates the process
