Method: RHC::GitHelpers#git_clone_repo
- Defined in:
- lib/rhc/git_helpers.rb
#git_clone_repo(git_url, repo_dir) ⇒ Object
:nocov:
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/rhc/git_helpers.rb', line 70 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 File.(repo_dir) end |