title: Shell script to clone a GitHub Repo
body: <p>I am trying to automate a process that contains a series of git commands.</p>
  
  <p>I want the shell script to deal with some interactive commands, like passing the username and password to <code>git clone url -v</code>. I verified that if I just run <code>git clone url -v</code> it will show the following in order:</p>
  
  <ol>
  <li>cloning into someRepo</li>
  <li>asking for username</li>
  <li>asking for password </li>
  </ol>
  
  <p>I've tried:</p>
  
  <ol>
  <li><code>echo -e 'username\n' | git clone url -v</code> </li>
  <li><code>echo -e 'username\npassword\n' | git clone url -v</code></li>
  <li><code>git clone url -v &lt;&lt;&lt; username\npassword\n</code></li>
  <li><code>(sleep 5;echo -e 'username\n' | git clone url -v)</code></li>
  </ol>
  
  <p>I thought that the first message <code>cloning into repo</code> will take some time. None of them is working, but all of them are showing the same message that <code>Username for url:</code>  </p>
  
  <p>Having spent lots of time in this, I know that</p>
  
  <pre><code>git clone https://$username:$password@enterpriseGithub.com/org/repo
  </code></pre>
  
  <p>is working, but it is UNSAFE to use since the log show the username and password explicitly. </p>