 <p>You can use :</p> <pre><code>git config --get-regexp user.name </code></pre> <p>For the <strong>user name</strong>. for the <strong>repository name</strong>, you may have different repositories with different names, so I guess parsing :</p> <pre><code>git remote get-url origin </code></pre> <p>could help if you only care about the origin ? The format would be (prefixes would differ between ssh or https) <code>git@github.com:{github_handle}/{repo_name}.git</code></p>