title: Deploying a private repo in Chef: What am I doing wrong with my deploy key?
body: <p>I am using chef to deploy a rails/node app.  Everything deploys fine when I deploy from a public github repository.  I would like to deploy from a private github repository, though, and am having trouble doing so.  Here is what I am currently doing</p>
  
  <pre><code>cd ~/.ssh                        # change directory to my .ssh directory
  ssh-keygen -f'deploy_key' -N ''  # create a deploy_key key pair without a passphrase
  cat deploy_key.pub | pbcopy      # copy the public key into my clipboard
  
  -go to https://github.com/HairyMezican/PrivateRepoName/admin/keys
  -click on 'Add another deploy key'
  -type 'deploy_key' into 'Title' field
  - ⌘V (paste command) into 'Key' field
  -click 'Add Key'
  
  tr "\n" "#" &lt; deploy_key | sed 's/#/\\n/g' | pbcopy      #copy the private key into my clipboard, except with all of the newlines replaced with a slash-n
  cd ~/chef-repo                                           #change over the the chef repo directory
  
  mate data_bags/apps/my_app.json                          #edit the appropriate data bag in TextMate
  --set the following couple of lines before saving
  -"repository": "https://HairyMezican@github.com/HairyMezican/PrivateRepoName.git",
  -"deploy_key": "⌘V (paste command into here)",
  
  knife data bag from file apps data_bags/apps/my_app.json                        #upload the databag to my chef server
  ssh root@12.34.56.789 "mkdir ~/.ssh"                                            #create a ssh directory on my remote server
  scp ~/.ssh/id_dsa root@12.34.56.789:.ssh/                                       #copy my private key over to the ssh directory on the remote server
  cat ~/.ssh/id_dsa.pub | ssh root@12.34.56.789 'cat - &gt;&gt; ~/.ssh/authorized_keys' #add my public key into the authorized keys list on the remote server
  knife bootstrap 12.34.56.789 -dubuntu10.04-gems -rrole[myapp]                   #tell my chef server to bootstrap the remote server
  </code></pre>
  
  <p>Everything goes fine until the bootstrap process tries to deploy from the private repository. and it displays this:</p>
  
  <pre><code>12.34.56.789 [Sat, 03 Dec 2011 01:41:42 +0000] INFO: Processing deploy_revision[myapp] action deploy (application::rails line 155)
  12.34.56.789 Password:
  </code></pre>
  
  <p>and then practically freezes up (technically, I can still type, but nothing I type affects the script), until 10 minutes later</p>
  
  <pre><code>12.34.56.789 [Sat, 03 Dec 2011 01:51:51 +0000] ERROR: deploy_revision[myapp] (application::rails line 155) has had an error
  12.34.56.789 [Sat, 03 Dec 2011 01:51:51 +0000] ERROR: deploy_revision[myapp] (/var/chef/cache/cookbooks/application/recipes/rails.rb:155:in `from_file') had an error:
  12.34.56.789 deploy_revision[myapp] (application::rails line 155) had an error: command timed out:
  </code></pre>
  
  <p>It then lists a blank output in stdout and stderr, and a stack trace of it trying to run the command</p>
  
  <p>What am I doing wrong and how can I deploy from a private repository?</p>