title: How to check the validity of a  remote git repository URL?
body: <p>Within a bash script, what would be the simplest way to verify that a git URL points to a valid git repo and that the script has access to read from it?</p>
  
  <p>Protocols that should be supported are <code>git@</code>, <code>https://</code>, and <code>git://</code>. Curl fails on the <code>git://</code> protocol.</p>
  
  <pre><code>git@github.com:UserName/Example.git
  https://UserName@github.com/UserName/Example.git
  git://github.com/UserName/Example.git
  </code></pre>
  
  <p>Note: I'm not asking to check to see if a URL is syntactically correct, I need to verify that a repo exists at the URL location entered from within a bash script.</p>