<h1 id="title">Always learning: new git tricks</h1> <div id="dates"> <span>Posted: <time id="post-date">2017-09-14</time></span> </div> <p> Imagine the following scenario: you keep the dotfiles for several machines under one git repo with some submodules, including one machine which clones a submodule from a GitHub repo that I own (so it's cloned over SSH, not HTTPS.) No problem when I do a recursive clone when using a key that's connected to my GitHub account - but when I'm on my gaming rig, or any other machine that is not connected, that clone URL fails as does the overall recursive clone operation. This can be "cleaned up" by hand but is a pain. </p> <p> Enter <a href="https://git-scm.com/docs/git-config#git-config-urlltbasegtinsteadOf"><code>url.<base>.pushInsteadOf</code></a>! With a quick one-liner or entry in your relevant git config, the above issue is solved by translating the <code>email@example.com:</code> URL into <code>https://github.com/</code>, seamlessly. In my case, a global change did the trick for the machines that needed it: </p> <pre><code>git config --global url."https://github.com/".insteadOf firstname.lastname@example.org:</code></pre> <p> Which added the following to my <code>.gitconfig</code>: </p> <pre><code>[url "https://github.com/"] insteadOf = email@example.com:</code></pre> And now that machine seamlessly translates that URL to one that's usable (when cloning.) Pretty rad!