title: How to push git repository through ssh using libgit2
body: <p>Since, the <strong>ssh</strong> support is already implemented, could anybody show me how to write a <code>push()</code> function? I had some success pushing through the local file system but when I try the <strong>ssh</strong> I only get a <strong>segfault</strong>.</p>
  
  <pre><code>int cred_acquire_cb(git_cred** cred,const char* url,unsigned int allowed_types, void* payload){
      check_error(git_cred_ssh_keyfile_passphrase_new(cred,"./bitbucket.pub","./bitbucket",NULL),"keyfile      passphrase");
  }
  
  int main(int argc, const char *argv[])
  {
      char* repo_path="./hello/.git";
      char* remote_name="origin";
  
      git_repository* repo;
      git_remote* remote;
      git_push* push;
      bool cred_acquire_called;
      int error;
  
      check_error(git_repository_open(&amp;repo, repo_path),"open repo");
      check_error(git_remote_load(&amp;remote,repo,remote_name),"load a remote");
      git_remote_set_cred_acquire_cb(remote, (git_cred_acquire_cb)cred_acquire_cb, &amp;cred_acquire_called);
      check_error(git_remote_connect(remote, GIT_DIRECTION_PUSH),"connect remote");
      check_error(git_push_new(&amp;push, remote),"new push object");
      check_error(git_push_add_refspec(push,"refs/heads/master:refs/heads/master"),"add push refspec");
  
     check_error(git_push_finish(push),"finish pushing");
     check_error(git_push_unpack_ok(push),"unpacked OK? ");
  
  
     git_push_free(push);
     git_remote_free(remote);
     git_repository_free(repo);
  
     return 0;
  }
  </code></pre>
  
  <p>I believe I'm not doing it right but I couldn't find any example to see how it's done.</p>
  
  <p><strong>UPDATE:</strong>  Ok I figured that I need some authentication to connect,  so I ended up with this. No <strong>segfault</strong> here. I still get  an Error on git_remote_connect though : <strong>Early EOF</strong>. What am I doing wrong ?</p>