title: Can I hold git credentials in environment variables?
body: <p>I'd like to create a very simple shell script, which will ultimately be called by another application, that updates a local git repository:</p>
  
  <pre><code>#!/bin/bash
  
  cd $1
  sudo git pull
  </code></pre>
  
  <p>When executing this I'm asked for credentials (I'm pulling from a private BitBucket repository).</p>
  
  <p>Can I ( briefly) store credentials in environment variables?</p>
  
  <pre><code>#!/bin/bash
  
  export  GIT_USERNAME=&lt;user&gt;
  export  GIT_PASSWORD=&lt;pass&gt;
  
  cd $1
  sudo git pull
  </code></pre>
  
  <p>The above doesn't work. Would anything? I could programmatically modify the origin url but that seems a bit execessive.</p>