diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index a3f29d2b9..fcd70fdcf 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -660,11 +660,6 @@ class Git(FetchMethod):
         Check if the repository has 'lfs' (large file) content
         """

-        if not ud.nobranch:
-            branchname = ud.branches[ud.names[0]]
-        else:
-            branchname = "master"
-
         # The bare clonedir doesn't use the remote names; it has the branch immediately.
         if wd == ud.clonedir:
             refname = ud.branches[ud.names[0]]
