<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sandeep Shelke</title>
    <description>The latest articles on DEV Community by Sandeep Shelke (@yantrakar).</description>
    <link>https://dev.to/yantrakar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4196151%2F6fd71c5b-0d16-4f35-89e4-38c8d1f29242.png</url>
      <title>DEV Community: Sandeep Shelke</title>
      <link>https://dev.to/yantrakar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yantrakar"/>
    <language>en</language>
    <item>
      <title>Wrong git email again? Pick the identity from the remote URL</title>
      <dc:creator>Sandeep Shelke</dc:creator>
      <pubDate>Tue, 20 Oct 2026 15:18:24 +0000</pubDate>
      <link>https://dev.to/yantrakar/wrong-git-email-again-pick-the-identity-from-the-remote-url-1d3n</link>
      <guid>https://dev.to/yantrakar/wrong-git-email-again-pick-the-identity-from-the-remote-url-1d3n</guid>
      <description>&lt;p&gt;Personal GitHub, work GitHub, GitLab, two Bitbuckets. More than once I committed with the wrong name and email. Sometimes the push was rejected. Sometimes nobody noticed for weeks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why &lt;code&gt;includeIf gitdir&lt;/code&gt; is not enough
&lt;/h2&gt;

&lt;p&gt;It picks the identity by folder. Repos don't always live in the right folder. The remote URL is a better signal: &lt;code&gt;git@bitbucket.org:client/api.git&lt;/code&gt; is a client repo wherever it is cloned.&lt;/p&gt;

&lt;p&gt;Git can do this itself since 2.36:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[includeIf "hasconfig:remote.*.url:git@bitbucket.org:client/**"]&lt;/span&gt;
    &lt;span class="py"&gt;path&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;~/.gitconfig-client&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add one SSH host entry per account, because GitHub and Bitbucket won't take the same key on two accounts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Or let gitpro write it
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://gitpro.dev" rel="noopener noreferrer"&gt;gitpro&lt;/a&gt; is a small open-source CLI that writes exactly this: the &lt;code&gt;includeIf&lt;/code&gt; blocks and the SSH entries, in a marked block, backed up first. No daemon, no git wrapper.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pipx &lt;span class="nb"&gt;install &lt;/span&gt;gitpro
gitpro setup   &lt;span class="c"&gt;# preview, then confirm once&lt;/span&gt;
gitpro why     &lt;span class="c"&gt;# which identity this repo should use, and the fix&lt;/span&gt;
gitpro scan    &lt;span class="c"&gt;# find repos that override it&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;scan&lt;/code&gt; found one old repo of mine with its own &lt;code&gt;user.email&lt;/code&gt; that ignored everything. &lt;code&gt;scan --fix&lt;/code&gt; removed it.&lt;/p&gt;

&lt;p&gt;Coding agents commit as whoever git says you are, so there is also a Claude Code hook that blocks a wrong-identity commit or push.&lt;/p&gt;

&lt;p&gt;Linux and macOS, MIT: &lt;a href="https://github.com/Yantrakar/gitpro" rel="noopener noreferrer"&gt;github.com/Yantrakar/gitpro&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written with help from Claude. The experience and the tool are mine.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>opensource</category>
      <category>devtools</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
