title: How to use deploy ssh key to clone private repos using Chef 12 on AWS OpsWorks
body: <p>I could clone public repos using Chef 12 on AWS OpsWorks as follows:</p>
  
  <pre><code>execute "get code" do
  user "root"
  cwd node['conf-cookbook']['project_root']
  command "git clone #{app['app_source']['url']}"
  end
  </code></pre>
  
  <p>but I don't know how to use deploy ssh key to clone private repos - I have searched a while and see a potential solution as follows:</p>
  
  <pre><code>git node['conf-cookbook']['app_dir'] do
    repository "ext::ssh -i #{app['app_source']['ssh_key']} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no #{app['app_source']['url']}"
    checkout_branch "master"
    action :sync
  end
  </code></pre>
  
  <p>which did not work with the error msg: </p>
  
  <pre><code>---- Begin output of git ls-remote "ext::ssh -i -----BEGIN RSA PRIVATE KEY----
  MIIJKQIBAAKCAgEApaViIRinBrusrE....[key detail]7xAOmo3NAmqcPxdrOI+hZJHh5KRvrQPLHY
  -----END RSA PRIVATE KEY----- -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@github.com:harrywang/app-main.git" "HEAD" ----
  STDOUT: 
  STDERR: Warning: Identity file -----BEGIN not accessible: No such file or directory.
  ssh: Could not resolve hostname rsa: Name or service not known 
  fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
  </code></pre>
  
  <p>Any help? Thanks!</p>