title: How to push to git on EC2
body: <p>I am trying to follow <a href="http://thelucid.com/2008/12/02/git-setting-up-a-remote-repository-and-doing-an-initial-push/" rel="noreferrer">this</a> instruction. I have a local git repo and when I do a git push, I need the repo to be pushed to my EC2 instance.</p>
  
  <p>But, in the above tutorial, when I do a <code>git push origin master</code>, I get <code>Permission denied (publickey)</code> error because I did not specify the identity file.</p>
  
  <p>Say, I login to EC2 like this: <code>ssh -i my_key.pem username@11.111.11.11</code></p>
  
  <p>So, can I do something similar here to: <code>git -i my_key.pem push origin master</code> or set the identity file in <code>.git/config</code></p>
  
  <p>So, how can I set it up?</p>
  
  <p>Update: Output of <code>git config -l</code></p>
  
  <pre><code>user.name=my name
  user.email=my_email_addreess@gmail.com
  github.user=userid
  core.repositoryformatversion=0
  core.filemode=true
  core.bare=false
  core.logallrefupdates=true
  core.ignorecase=true
  remote.origin.url=ec2_id@my_e2_ip_address:express_app
  remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
  </code></pre>
  
  <p><strong>Update (from @Jon's <a href="https://stackoverflow.com/questions/4632749/how-to-push-to-git-on-ec2#comment5097220_4632766">comment</a>):</strong></p>
  
  <p>If you have your key in an odd path just run <code>ssh-add /private/key/path</code>. This worked for me.</p>