title: Running git clone from C# Process ignoring input for passphrase
body: <p>I am attempting to run git clone through a C# process that also passes in the location of the SSH key. </p>
  
  <p>The command:</p>
  
  <pre><code>cd C:\\repo-location &amp;&amp; SET GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -i path\to\.ssh\privKey &amp;&amp; git clone git@bitbucket.org:location.git
  </code></pre>
  
  <p>will prompt for the passphrase as expected, however, using Process seems to ignore it so I am getting a "git@bitbucket.org: Permission denied (publickey)." error immediately.</p>
  
  <p>What is also interesting is the Process only returns from StandardError.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>ProcessStartInfo pInfo = new ProcessStartInfo();
  pInfo.FileName = "C:\\Git\\git-cmd.exe";
  pInfo.Arguements = "cd C:\\repo-location &amp;&amp; " +
      "SET GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -i \"path\to\.ssh\privKey\" &amp;&amp; " +
      "git clone git@bitbucket.org:location.git";
  pInfo.RedirectStandardOutput = true;
  pInfo.RedirectStandardError = true;
  pInfo.RedirectStandardInput = true;
  pInfo.UseShellExecute = false;
  pInfo.CreateNoWindow = true;
  
  Process process = Process.Start(pInfo);
  process.BeginOutputReadLine();
  process.BeginErrorReadLine();
  process.ErrorDataReceived += new DataReceivedEventHandler((object sendingProcess, DataReceivedEventArgs outLine) =&gt; {
      if (!string.IsNullOrEmpty(outLine.Data) &amp;&amp; outLine.Data.StartsWith("Enter passphrase")) {
          //Never hits here...
          process.StandardInput.WriteLine(password);
      }
  });
  process.OutputDataReceived += new DataReceivedEventHandler((object sendingProcess, DataReceivedEventArgs outLine) =&gt; {
      if (!string.IsNullOrEmpty(outLine.Data) &amp;&amp; outLine.Data.StartsWith("Enter passphrase")) {
          //Never hits here...
          process.StandardInput.WriteLine(password);
      }
  });
  </code></pre>
  
  <p>I tried other approaches to get SSH working with git config core.sshCommand but that doesn't even prompt for a passphrase when running from git-cmd.exe.</p>
  
  <p>I prefer NOT to use ssh-agent since there can be a few keys I need to point to.</p>
  
  <p>EDIT:</p>
  
  <p>This can probably be boiled down to allowing a C# process to not eat the prompt for a passphrase and that is the issue with this.  Does anyone have any solutions to that?</p>
  
  <p>MORE INFO:</p>
  
  <p>I noticed that even using the command in cmd.exe and redirecting stdout will also prevent interaction.  But changing the code to not redirect still skips the interaction.</p>