diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 0ad987c596..6149b1726a 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1067,6 +1067,22 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
     # Return of None or a value means we're finished
     # False means try another url
 
+    # Skip fetching it when the local url's path doesn't exist
+    if ud.parm.get('protocol', '') == 'file':
+        found = False
+        check_paths = [ud.path]
+        # Git works with or without '.git' suffix
+        if ud.path.endswith('.git'):
+            check_paths.append(ud.path[:-4])
+        else:
+            check_paths.append('%s.git' % ud.path)
+        for check_path in check_paths:
+            if os.path.exists(check_path):
+                found = True
+                break
+        if not found:
+            return False
+
     if ud.lockfile and ud.lockfile != origud.lockfile:
         lf = bb.utils.lockfile(ud.lockfile)
 
