title: How to input password to git pull command?
body: <p>I have written scripts for Windows and Linux to essentially set up a new users workspace with all the git repositories from our server.</p>
  
  <p>I would like the user to enter the password for our server once, store it in a local variable, pass that variable to each <code>git pull</code> command, then erase the password variable and exit.</p>
  
  <p>How can I input the password when the <code>git pull</code> command requests it? Both for Windows batch file and a Linux shell script.</p>
  
  <p>Here is code from the Linux script:</p>
  
  <pre><code>#!/bin/bash
  
  echo "Enter password: "
  read pswd
  clear #No screen peaking
  
  #This is repeated for each repo
  location=folderName
  mkdir $location
  cd $location
  git init
  git remote add origin git@&lt;server&gt;:$location.git
  git pull origin master 
  #Above prompts for password &amp; is where I want to automatically input $pswd
  </code></pre>
  
  <p>I've tried various things recommended on SO and elsewhere, such as piping, reading from .txt file, etc. I would prefer to not need anything more than plain old windows cmd and Linux terminal commands. And as this script is just for set up purposes, I do not need to securely store the password permanently with something like ssh agent.</p>
  
  <p>I'm running Windows 7 and Ubuntu 12.10, but this script is meant for setting up new users, so it should ideally work on most distributions.</p>