diff --git a/tools/checkout-deps.ps1 b/tools/checkout-deps.ps1
index 50ab1f2e..f7b4f537 100644
--- a/tools/checkout-deps.ps1
+++ b/tools/checkout-deps.ps1
@@ -47,16 +47,23 @@ Function Checkout-Repo
         If ($Origin)
         {
             Set-Location $Name
-            & git  remote rm origin 2>&1 | Write-Host
-            & git remote add origin $Origin 2>&1 | Write-Host
+            & git remote set-url origin $Origin 2>&1 | Write-Host
             Set-Location ..
         }
     }
     Else
     {
         Set-Location $Name
+        If ($Origin)
+        {
+            & git remote set-url origin ..\$Repo 2>&1 | Write-Host
+        }
         & git checkout $Branch 2>&1 | Write-Host
         & git pull origin $Branch 2>&1 | Write-Host
+        If ($Origin)
+        {
+            & git remote set-url origin $Origin 2>&1 | Write-Host
+        }
         Set-Location ..
     }
 }
@@ -81,7 +88,7 @@ else
 }
 
 $SDKS | % {
-    Checkout-Repo -Name "hl2sdk-$_" -Branch $_ "hl2sdk-proxy-repo" -Repo "https://github.com/alliedmodders/hl2sdk.git"
+    Checkout-Repo -Name "hl2sdk-$_" -Branch $_ -Repo "hl2sdk-proxy-repo" "https://github.com/alliedmodders/hl2sdk.git"
 }
 
 Checkout-Repo -Name "ambuild" -Branch "master" -Repo "https://github.com/alliedmodders/ambuild.git"
diff --git a/tools/checkout-deps.sh b/tools/checkout-deps.sh
index 3524aa38..d2b10332 100755
--- a/tools/checkout-deps.sh
+++ b/tools/checkout-deps.sh
@@ -74,14 +74,19 @@ checkout ()
     git clone $repo -b $branch $name
     if [ -n "$origin" ]; then
       cd $name
-      git remote rm origin
-      git remote add origin $origin
+      git remote set-url origin $origin
       cd ..
     fi
   else
     cd $name
+    if [ -n "$origin" ]; then
+      git remote set-url origin ../$repo
+    fi
     git checkout $branch
     git pull origin $branch
+    if [ -n "$origin" ]; then
+      git remote set-url origin $origin
+    fi
     cd ..
   fi
 }