# File lib/rhc/git_helpers.rb, line 71
    def git_clone_repo(git_url, repo_dir)
      # quote the repo to avoid input injection risk
      destination = (repo_dir ? " \"#{repo_dir}\"" : "")
      cmd = "git clone #{git_url}#{destination}"
      debug "Running #{cmd}"

      status, stdout, stderr = run_with_tee(cmd)

      if status != 0
        case stderr
        when /fatal: destination path '[^']*' already exists and is not an empty directory./
          raise RHC::GitDirectoryExists, "The directory you are cloning into already exists."
        when /^Permission denied \(.*?publickey.*?\).$/
          raise RHC::GitPermissionDenied, "You don't have permission to access this repository.  Check that your SSH public keys are correct."
        else
          raise RHC::GitException, "Unable to clone your repository. Called Git with: #{cmd}"
        end
      end

      success "Your application code is now in '#{repo_dir}'"
    end