 ;### Core Git #################################################################
 
 (defn- create-mirror-clone [url path] 
+  (system/exec ["rm" "-rf" path])
   (system/exec-with-success-or-throw
     ["git" "clone" "--mirror" url path] 
     {:add-env {"GIT_SSL_NO_VERIFY" "1"}

  (or (@repository-agents-atom repository-url)
      ((swap! repository-agents-atom 
              (fn [repository-agents repository-url]
                (conj repository-agents 
                      {repository-url
                       (agent {:repository-url repository-url
                               :repository-path (canonical-repository-path repository-url) } 
                              :error-mode :continue)}))
              repository-url) 
       repository-url)))


    ))


;### Repo path ################################################################

(defn- canonical-repository-path [repository-url]
  (let [absolute-repos-path (fs/absolute (:git_repos_dir (get-config)))
        path (str absolute-repos-path  (File/separator) 
                  (ci-fs/path-proof repository-url))]
    (assert (> (count path) (count (str absolute-repos-path))))
    path))

;### Agents ###################################################################

