<?xml version="1.0" encoding="utf-8" standalone="yes"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><script src="https://www.rss.style/js/atom-style.js" xmlns="http://www.w3.org/1999/xhtml"/><title>Tower of Kubes</title><link rel="self" type="application/atom+xml" hreflang="en" href="https://www.towerofkubes.com/tags/snippets/feed.xml"/><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/tags/snippets/"/><link rel="alternate" type="application/rss+xml" hreflang="en" href="https://www.towerofkubes.com/tags/snippets/index.xml"/><id>/</id><updated>2025-11-10T00:00:00Z</updated><author><name>Ro'i Bandel</name></author><generator>Hugo 0.157.0</generator><entry><title>Oxc Workflow</title><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/articles/oxc-workflow/"/><id>https://www.towerofkubes.com/articles/oxc-workflow/</id><updated>2025-11-10T00:00:00Z</updated><summary type="html">How to setup new Node.js projects, with linting and formatting using Oxc.</summary><content type="html"><![CDATA[<p>Here’s how I like to setup new Node.js projects, with linting and formatting using Oxc.</p>

<h2 class="relative group">Oxc
    <div id="oxc" class="anchor"></div>
    
</h2>
<p>I wrote about Oxc (The JavaScript Oxidation Compiler) in <a href="/articles/next-generation-tooling-for-developers/" >Next Generation Tooling for Developers</a>. When I first wrote this article, Oxc already included a linter (<a href="https://www.npmjs.com/package/oxlint"  target="_blank" rel="noreferrer"><code>oxlint</code></a>, which can replace ESLint), but the formatter was not available yet. Since then, VoidZero has continued the development of Oxc, not only launching Vite+ but also launching a formatter (<a href="https://www.npmjs.com/package/oxfmt"  target="_blank" rel="noreferrer"><code>oxfmt</code></a>, which can replace Prettier). With the combination of <a href="https://www.npmjs.com/package/oxlint"  target="_blank" rel="noreferrer"><code>oxlint</code></a> and <a href="https://www.npmjs.com/package/oxfmt"  target="_blank" rel="noreferrer"><code>oxfmt</code></a>, I now have a modern-alternative to ESLint + Prettier. Note that this might not work as a replacement in all existing projects that rely on specific configurations of ESLint and/or Prettier. However, for new Node.js projects, I will strive to go with the Oxc stack.</p>

<h3 class="relative group">Why Oxc instead of ESLint + Prettier?
    <div id="why-oxc-instead-of-eslint--prettier" class="anchor"></div>
    
</h3>
<p>The two main reasons I prefer Oxc is speed and ease of configuration; as I have explained in <a href="/articles/next-generation-tooling-for-developers/" >Next Generation Tooling for Developers</a>, the Rust-based tools are noticeably faster. In addition, they have a more modern design with more intutive configuration. In particular, ESLint has become a nightmare to configure after the breaking changes in ESLint v9.</p>

<h2 class="relative group">Guide
    <div id="guide" class="anchor"></div>
    
</h2>

<h3 class="relative group">One-time run
    <div id="one-time-run" class="anchor"></div>
    
</h3>
<p>These tools can be run in a project without being installed or added to <code>package.json</code> using npx commands:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">npx oxlint@latest</span></span></code></pre></div></div>
<hr>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">npx oxfmt@latest</span></span></code></pre></div></div>

<h3 class="relative group">Install Oxc tools in NPM project
    <div id="install-oxc-tools-in-npm-project" class="anchor"></div>
    
</h3>
<p>For consistent usage in an npm project, Oxc packages can be added as <a href="https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file"  target="_blank" rel="noreferrer"><code>devDependencies</code></a>.</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">npm install --save-dev oxlint@latest oxlint-tsgolint@latest oxfmt@latest</span></span></code></pre></div></div>

<h3 class="relative group">Initialize configuration for oxlint
    <div id="initialize-configuration-for-oxlint" class="anchor"></div>
    
</h3>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>Quote</span>
      </div>
      <div class="admonition-content">
        <p>Configuration files for Oxlint are written in JSON, with support for comments (JSONC). Oxlint will automatically search for files named <code>.oxlintrc.json</code> and automatically use those. But you can name the file anything when you are using the <code>--config</code> CLI option.</p>
      </div>
    </div><ul>
<li><a href="https://oxc.rs/docs/guide/usage/linter/config.html"  target="_blank" rel="noreferrer">Configuring Oxlint | The JavaScript Oxidation Compiler</a></li>
</ul>
<p>Use the <a href="https://oxc.rs/docs/guide/usage/linter/cli.html#basic-configuration"  target="_blank" rel="noreferrer"><code>--init</code></a> option to initialize a <code>.oxlintrc.json</code> file:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1">## If installed</span>
</span></span><span class="line"><span class="cl">./node_modules/.bin/oxlint --init</span></span></code></pre></div></div>
<hr>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1">## If not installed</span>
</span></span><span class="line"><span class="cl">npx oxlint@latest --init</span></span></code></pre></div></div>

<h3 class="relative group">Initialize configuration for oxfmt
    <div id="initialize-configuration-for-oxfmt" class="anchor"></div>
    
</h3>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>Quote</span>
      </div>
      <div class="admonition-content">
        <p>By default, <code>oxfmt</code> automatically tries to find the nearest <code>.oxfmtrc.json</code> or <code>.oxfmtrc.jsonc</code> file from current working directory. If not found, default configuration is used.</p>
<p>Also you can specify your config file by <code>-c yourconfig.jsonc</code> flag.</p>
<p>Almost all format options are compatible with Prettier’s <a href="https://prettier.io/docs/options"  target="_blank" rel="noreferrer">options</a>. So you may finish your setup by just renaming <code>.prettierrc.json</code> to <code>.oxfmtrc.jsonc</code>.</p>
      </div>
    </div><ul>
<li><a href="https://oxc.rs/docs/guide/usage/formatter.html#configuration-file"  target="_blank" rel="noreferrer">Formatter | The JavaScript Oxidation Compiler</a></li>
</ul>
<p>Use the <a href="https://oxc.rs/docs/guide/usage/formatter/cli.html#mode-options"  target="_blank" rel="noreferrer"><code>--init</code></a> option to initialize a <code>.oxfmtrc.json</code> file:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1">## If installed</span>
</span></span><span class="line"><span class="cl">./node_modules/.bin/oxfmt --init</span></span></code></pre></div></div>
<hr>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1">## If not installed</span>
</span></span><span class="line"><span class="cl">npx oxfmt@latest --init</span></span></code></pre></div></div>
<hr>

    <details class="admonition note">
      <summary class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>A previous version of this article, suggested to use prettier-init (before oxfmt had the <code>--init</code> option).</span>
      </summary>
      <div class="admonition-content">
        <p>The <a href="https://github.com/gabrielperales/prettier-init"  target="_blank" rel="noreferrer">prettier-init</a> tool can be used to help bootstrap configuration:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">npx prettier-init@latest
</span></span><span class="line"><span class="cl">mv <span class="s2">".prettierrc.json"</span> <span class="s2">".oxfmtrc.json"</span></span></span></code></pre></div></div>
      </div>
    </details>
<h3 class="relative group"><code>scripts</code> block in <code>package.json</code>
    <div id="scripts-block-in-packagejson" class="anchor"></div>
    
</h3>
<p>For easy and consistent usage across the project, add to the <code>scripts</code> block in <code>package.json</code>:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl">  <span class="s2">"scripts"</span><span class="err">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"lint"</span><span class="p">:</span> <span class="s2">"oxlint --type-aware --type-check ."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"lint:fix"</span><span class="p">:</span> <span class="s2">"oxlint --type-aware --type-check . --fix"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"lint:fix-all"</span><span class="p">:</span> <span class="s2">"oxlint --type-aware --type-check . --fix --fix-suggestions --fix-dangerously"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"format"</span><span class="p">:</span> <span class="s2">"oxfmt ."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="nt">"format:check"</span><span class="p">:</span> <span class="s2">"oxfmt . --check"</span>
</span></span><span class="line"><span class="cl">  <span class="p">}</span><span class="err">,</span></span></span></code></pre></div></div>

<h3 class="relative group">Commit and push all changed and added files
    <div id="commit-and-push-all-changed-and-added-files" class="anchor"></div>
    
</h3>
<p>Commit and push all relevant files that were changed or added:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">git add <span class="s2">".oxfmtrc.json"</span> <span class="s2">".oxlintrc.json"</span> <span class="s2">"package.json"</span> <span class="s2">"package-lock.json"</span>
</span></span><span class="line"><span class="cl">git commit -s
</span></span><span class="line"><span class="cl">git push</span></span></code></pre></div></div>
<hr>
<p><em>Featured image by <a href="https://unsplash.com/@6heinz3r?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Gabriel Heinzer</a> on <a href="https://unsplash.com/?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Unsplash</a>.</em></p>
]]></content><author><name>Ro'i Bandel</name></author><category term="node" label="Node" scheme="https://www.towerofkubes.com/tags/node/"/><category term="javascript" label="Javascript" scheme="https://www.towerofkubes.com/tags/javascript/"/><category term="typescript" label="Typescript" scheme="https://www.towerofkubes.com/tags/typescript/"/><category term="tools" label="Tools" scheme="https://www.towerofkubes.com/tags/tools/"/><category term="snippets" label="Snippets" scheme="https://www.towerofkubes.com/tags/snippets/"/><published>2025-11-10T00:00:00Z</published></entry><entry><title>Lima and Colima</title><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/articles/lima-and-colima/"/><id>https://www.towerofkubes.com/articles/lima-and-colima/</id><updated>2025-10-16T00:00:00Z</updated><summary type="html">Overview of Lima and Colima on macOS, how they differ, install commands, Docker usage examples, and Apple’s native Container runtime.</summary><content type="html"><![CDATA[<p>Today I learned about <a href="https://lima-vm.io/"  target="_blank" rel="noreferrer">Lima</a> and <a href="https://github.com/abiosoft/colima"  target="_blank" rel="noreferrer">Colima</a>, which help run Linux VMs and containers on macOS.</p>
<p>I learned about these tools while writing <a href="/articles/how-to-install-docker/" >How To Install Docker</a>. Although I’ve heard about them in the past, I kept forgetting what they were called, which is one reason I am writing about them now.</p>

<h2 class="relative group">Lima
    <div id="lima" class="anchor"></div>
    
</h2>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>Lima launches Linux virtual machines with automatic file sharing and port forwarding (similar to WSL2).</span>
      </div>
    </div><ul>
<li><a href="https://lima-vm.io/docs/"  target="_blank" rel="noreferrer">Lima: Linux Machines | Lima</a></li>
</ul>
<p>As this description states, Lima is similar to WSL. When using Windows, I have gotten used to a workflow based around WSL, both <a href="/articles/how-to-install-docker/" >for Docker</a> and <a href="/articles/git-setup-for-windows-and-wsl/" >with Git</a>. I have not used macOS yet but expect to one day get a MacBook as a work laptop, and will have to learn an effective workflow for macOS.</p>

<h2 class="relative group">Colima
    <div id="colima" class="anchor"></div>
    
</h2>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>Colima - container runtimes on macOS (and Linux) with minimal setup.</span>
      </div>
    </div><ul>
<li><a href="https://github.com/abiosoft/colima"  target="_blank" rel="noreferrer">GitHub - abiosoft/colima: Container runtimes on macOS (and Linux) with minimal setup</a></li>
</ul>

<h2 class="relative group">Differences between Lima and Colima
    <div id="differences-between-lima-and-colima" class="anchor"></div>
    
</h2>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>How does Colima compare to Lima?</span>
      </div>
      <div class="admonition-content">
        <p>Colima is basically a higher level usage of Lima and utilises Lima to provide Docker, Containerd and/or Kubernetes.</p>
      </div>
    </div><ul>
<li><a href="https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#how-does-colima-compare-to-lima"  target="_blank" rel="noreferrer">colima/docs/FAQ.md at main · abiosoft/colima · GitHub</a></li>
</ul>
<hr>

    <div class="admonition quote">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"/></svg>
        <span>“How does Lima relate to Colima?”</span>
      </div>
      <div class="admonition-content">
        <p><a href="https://github.com/abiosoft/colima"  target="_blank" rel="noreferrer">Colima</a> is a third-party project that wraps Lima to provide an alternative user experience for launching containers.</p>
<p>The key difference is that Colima launches Docker by default, while Lima launches containerd by default.</p>
      </div>
    </div><ul>
<li><a href="https://lima-vm.io/docs/faq/colima/"  target="_blank" rel="noreferrer">Colima (third-party project) | Lima</a></li>
</ul>
<p>It’s worth noting that current versions of Lima also support <a href="https://lima-vm.io/docs/examples/containers/docker/"  target="_blank" rel="noreferrer">using Docker as a container runtime</a>, and the same is true the other way: Colima supports <a href="https://github.com/abiosoft/colima?tab=readme-ov-file#containerd"  target="_blank" rel="noreferrer">using containerd as a container runtime</a>.</p>

<h2 class="relative group">Installation
    <div id="installation" class="anchor"></div>
    
</h2>

<h3 class="relative group">Install Lima
    <div id="install-lima" class="anchor"></div>
    
</h3>
<ul>
<li><a href="https://lima-vm.io/docs/installation/"  target="_blank" rel="noreferrer">Installation | Lima</a></li>
</ul>

    <div class="admonition example">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M192 96a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm-8 384l0-128 16 0 0 128c0 17.7 14.3 32 32 32s32-14.3 32-32l0-288 56 0 64 0 16 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-16 0 0-64 192 0 0 192-192 0 0-32-64 0 0 48c0 26.5 21.5 48 48 48l224 0c26.5 0 48-21.5 48-48l0-224c0-26.5-21.5-48-48-48L368 0c-26.5 0-48 21.5-48 48l0 80-76.9 0-65.9 0c-33.7 0-64.9 17.7-82.3 46.6l-58.3 97c-9.1 15.1-4.2 34.8 10.9 43.9s34.8 4.2 43.9-10.9L120 256.9 120 480c0 17.7 14.3 32 32 32s32-14.3 32-32z"/></svg>
        <span>Example</span>
      </div>
      <div class="admonition-content">
        <div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># Homebrew</span>
</span></span><span class="line"><span class="cl">brew install lima</span></span></code></pre></div></div>
<hr>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># MacPorts</span>
</span></span><span class="line"><span class="cl">sudo port install lima</span></span></code></pre></div></div>
<hr>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># Nix</span>
</span></span><span class="line"><span class="cl">nix-env -i lima</span></span></code></pre></div></div>
      </div>
    </div>
<h3 class="relative group">Install Colima
    <div id="install-colima" class="anchor"></div>
    
</h3>
<p>Colima is available on Homebrew, MacPorts, and Nix. <a href="https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md"  target="_blank" rel="noreferrer">Check here for other installation options</a>.</p>

    <div class="admonition example">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M192 96a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm-8 384l0-128 16 0 0 128c0 17.7 14.3 32 32 32s32-14.3 32-32l0-288 56 0 64 0 16 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-16 0 0-64 192 0 0 192-192 0 0-32-64 0 0 48c0 26.5 21.5 48 48 48l224 0c26.5 0 48-21.5 48-48l0-224c0-26.5-21.5-48-48-48L368 0c-26.5 0-48 21.5-48 48l0 80-76.9 0-65.9 0c-33.7 0-64.9 17.7-82.3 46.6l-58.3 97c-9.1 15.1-4.2 34.8 10.9 43.9s34.8 4.2 43.9-10.9L120 256.9 120 480c0 17.7 14.3 32 32 32s32-14.3 32-32z"/></svg>
        <span>Example</span>
      </div>
      <div class="admonition-content">
        <div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># Homebrew</span>
</span></span><span class="line"><span class="cl">brew install colima</span></span></code></pre></div></div>
<hr>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># MacPorts</span>
</span></span><span class="line"><span class="cl">sudo port install colima</span></span></code></pre></div></div>
<hr>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># Nix</span>
</span></span><span class="line"><span class="cl">nix-env -iA nixpkgs.colima</span></span></code></pre></div></div>
      </div>
    </div>
<h2 class="relative group">Using Docker with Lima and Colima
    <div id="using-docker-with-lima-and-colima" class="anchor"></div>
    
</h2>

<h3 class="relative group">Docker with Lima
    <div id="docker-with-lima" class="anchor"></div>
    
</h3>
<p><a href="https://lima-vm.io/docs/examples/containers/docker/"  target="_blank" rel="noreferrer">Documentation / Examples / Containers / Docker | Lima</a></p>

<h4 class="relative group">Lima Docker Rootless
    <div id="lima-docker-rootless" class="anchor"></div>
    
</h4>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">limactl start template://docker
</span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">DOCKER_HOST</span><span class="o">=</span><span class="k">$(</span>limactl list docker --format <span class="s1">'unix://{{.Dir}}/sock/docker.sock'</span><span class="k">)</span>
</span></span><span class="line"><span class="cl">docker run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine</span></span></code></pre></div></div>

<h4 class="relative group">Lima Docker Rootful
    <div id="lima-docker-rootful" class="anchor"></div>
    
</h4>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">limactl start template://docker-rootful
</span></span><span class="line"><span class="cl"><span class="nb">export</span> <span class="nv">DOCKER_HOST</span><span class="o">=</span><span class="k">$(</span>limactl list docker-rootful --format <span class="s1">'unix://{{.Dir}}/sock/docker.sock'</span><span class="k">)</span>
</span></span><span class="line"><span class="cl">docker run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpine</span></span></code></pre></div></div>

<h3 class="relative group">Docker with Colima
    <div id="docker-with-colima" class="anchor"></div>
    
</h3>
<p>Docker client is required for Docker runtime. Installable with brew <code>brew install docker</code>.</p>
<p>You can use the <code>docker</code> client on macOS after <code>colima start</code> with no additional setup.</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew install docker
</span></span><span class="line"><span class="cl">colima start</span></span></code></pre></div></div>

<h2 class="relative group">Linux Support
    <div id="linux-support" class="anchor"></div>
    
</h2>
<p><strong>Both run on Linux hosts.</strong> Lima also supports <a href="https://github.com/lima-vm/lima?tab=readme-ov-file#lima-linux-machines"  target="_blank" rel="noreferrer">non-macOS hosts (Linux, NetBSD, etc.)</a> and <a href="https://github.com/abiosoft/colima?tab=readme-ov-file#features"  target="_blank" rel="noreferrer">Colima’s README lists Linux as supported</a>.</p>
<p>There’s less reason to use Lima/Colima on Linux than on macOS, but it may still be useful in certain cases, since it is another way to run VMs on Linux.</p>

<h2 class="relative group">Apple Container
    <div id="apple-container" class="anchor"></div>
    
</h2>
<p>After years of mac users using projects such as Lima, Colima and others in order to run containers on macOS, Apple released their own solution a few months ago: <a href="https://opensource.apple.com/projects/container/"  target="_blank" rel="noreferrer">Container</a>. This seems like a good solution that likely has good performance. Notably, this solution is not based on Docker, but can nevertheless run OCI containers.</p>
<hr>
<p><em>Featured image by <a href="https://unsplash.com/@creatorsproduce?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Aarom Ore</a> on <a href="https://unsplash.com/photos/city-on-island-during-day-Yrqyn1Gb80k?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Unsplash</a>.</em></p>
]]></content><author><name>Ro'i Bandel</name></author><category term="tools" label="Tools" scheme="https://www.towerofkubes.com/tags/tools/"/><category term="container" label="Container" scheme="https://www.towerofkubes.com/tags/container/"/><category term="til" label="Til" scheme="https://www.towerofkubes.com/tags/til/"/><category term="snippets" label="Snippets" scheme="https://www.towerofkubes.com/tags/snippets/"/><category term="guide" label="Guide" scheme="https://www.towerofkubes.com/tags/guide/"/><published>2025-10-16T00:00:00Z</published></entry><entry><title>How To Install Docker</title><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/articles/how-to-install-docker/"/><id>https://www.towerofkubes.com/articles/how-to-install-docker/</id><updated>2025-10-16T00:00:00Z</updated><summary type="html">Step-by-step Docker Engine install on Linux and WSL with post-install steps, verification commands, and alternative container runtime options.</summary><content type="html"><![CDATA[<p>This is how I like to install Docker on my workstations.</p>

<h2 class="relative group">Choose Environment
    <div id="choose-environment" class="anchor"></div>
    
</h2>
<p>Docker runs best on Linux. If using Linux, skip to <a href="/articles/how-to-install-docker/#install-docker" >Install Docker</a> below. If using Windows, read the <a href="/articles/how-to-install-docker/#wsl" >WSL</a> section first.</p>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>Note</span>
      </div>
      <div class="admonition-content">
        <p>I don’t use macOS so cannot advise on installation methods for Docker on macOS. However, Lima, Colima and Rancher Desktop are possible options. See <a href="/articles/how-to-install-docker/#alternative-docker-installation-methods" >Alternative Docker Installation Methods</a> below.</p>
      </div>
    </div>
<h2 class="relative group">WSL
    <div id="wsl" class="anchor"></div>
    
</h2>
<p>On Windows, Docker Engine can be installed inside WSL. This is an alternative to using Docker Desktop (unlike Docker CE, Docker Desktop is not open source).</p>

<h3 class="relative group">Install WSL command
    <div id="install-wsl-command" class="anchor"></div>
    
</h3>
<p>You can install everything you need to run WSL with a single command. Open PowerShell in administrator mode by right-clicking and selecting “Run as administrator”, enter the <code>wsl --install</code> command, then restart your machine.</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="n">wsl</span> <span class="p">-</span><span class="n">-install</span></span></span></code></pre></div></div>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>Note</span>
      </div>
      <div class="admonition-content">
        <p>This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux. (<a href="https://learn.microsoft.com/en-us/windows/wsl/basic-commands#install"  target="_blank" rel="noreferrer">This default distribution can be changed</a>).</p>
      </div>
    </div>
<h2 class="relative group">Install Docker
    <div id="install-docker" class="anchor"></div>
    
</h2>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>These commands all need to run in a Linux shell.</span>
      </div>
    </div>
<h3 class="relative group">1. Install using the official <a href="https://github.com/docker/docker-install"  target="_blank" rel="noreferrer">Docker installation script</a>
    <div id="1-install-using-the-official-docker-installation-script" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">/bin/sh -c <span class="s2">"</span><span class="k">$(</span>curl -fsSL https://get.docker.com<span class="k">)</span><span class="s2">"</span></span></span></code></pre></div></div>

    <div class="admonition important">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/></svg>
        <span>If you are using WSL, you may get a warning about Docker Desktop. Since we do not use Docker Desktop, simply <strong>ignore</strong> this warning (wait 20 seconds and the installation will resume).</span>
      </div>
    </div>
<h3 class="relative group">2. After the install completes, complete the <a href="https://docs.docker.com/engine/install/linux-postinstall/"  target="_blank" rel="noreferrer">Linux post-installation steps for Docker Engine</a> by running the following commands
    <div id="2-after-the-install-completes-complete-the-linux-post-installation-steps-for-docker-engine-by-running-the-following-commands" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo usermod -aG <span class="s2">"docker"</span> <span class="s2">"</span><span class="si">${</span><span class="nv">USER</span><span class="si">}</span><span class="s2">"</span>
</span></span><span class="line"><span class="cl">newgrp docker
</span></span><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> --now docker.service
</span></span><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> --now containerd.service</span></span></code></pre></div></div>

<h2 class="relative group">Optional: Confirm Docker Is Installed
    <div id="optional-confirm-docker-is-installed" class="anchor"></div>
    
</h2>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>These commands all need to run in a Linux shell.</span>
      </div>
    </div>
<h3 class="relative group">1. Confirm <code>docker</code> is installed and check versions
    <div id="1-confirm-docker-is-installed-and-check-versions" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker version
</span></span><span class="line"><span class="cl">docker --version</span></span></code></pre></div></div>

<h3 class="relative group">2. Confirm the <code>docker buildx</code> and <code>docker compose</code> plugins are also installed (likely already installed alongside <code>docker</code>)
    <div id="2-confirm-the-docker-buildx-and-docker-compose-plugins-are-also-installed-likely-already-installed-alongside-docker" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker buildx version
</span></span><span class="line"><span class="cl">docker compose version</span></span></code></pre></div></div>

<h3 class="relative group">3. Run a test container
    <div id="3-run-a-test-container" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">docker run --rm hello-world</span></span></code></pre></div></div>

<h2 class="relative group">Alternative Docker Installation Methods
    <div id="alternative-docker-installation-methods" class="anchor"></div>
    
</h2>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>Note</span>
      </div>
      <div class="admonition-content">
        <p>I do not suggest Docker Desktop as an installation method because it is not open source.</p>
      </div>
    </div><ul>
<li><strong>Manual Install:</strong> Follow the steps in <a href="https://docs.docker.com/engine/install/"  target="_blank" rel="noreferrer">Install | Docker Docs</a> according to your distribution.</li>
<li><strong>Ansible:</strong> Use <a href="https://github.com/geerlingguy/ansible-role-docker"  target="_blank" rel="noreferrer">geerlingguy/ansible-role-docker: Ansible Role - Docker</a>.</li>
<li><strong>Docker on NixOS:</strong> <a href="https://nixos.wiki/wiki/Docker"  target="_blank" rel="noreferrer">Docker - NixOS Wiki</a>.</li>
<li><strong>Rancher Desktop:</strong> Follow <a href="https://docs.rancherdesktop.io/getting-started/installation/"  target="_blank" rel="noreferrer">Installation | Rancher Desktop Docs</a>.</li>
<li><strong>Lima:</strong> <a href="https://lima-vm.io/"  target="_blank" rel="noreferrer">Lima</a>; <a href="https://github.com/lima-vm/lima"  target="_blank" rel="noreferrer">GitHub - lima-vm/lima: Linux virtual machines, with a focus on running containers</a>.</li>
<li><strong>Colima:</strong> <a href="https://github.com/abiosoft/colima"  target="_blank" rel="noreferrer">GitHub - abiosoft/colima: Container runtimes on macOS (and Linux) with minimal setup</a>.</li>
</ul>

<h2 class="relative group">Docker Alternatives for Running OCI Containers
    <div id="docker-alternatives-for-running-oci-containers" class="anchor"></div>
    
</h2>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>Note</span>
      </div>
      <div class="admonition-content">
        <p>All of these tools can run <a href="https://opencontainers.org/"  target="_blank" rel="noreferrer">OCI containers</a> (sometimes referred to as “Docker containers”).</p>
      </div>
    </div><ul>
<li><a href="https://podman.io/"  target="_blank" rel="noreferrer">Podman</a> and <a href="https://podman-desktop.io/"  target="_blank" rel="noreferrer">Podman Desktop</a></li>
<li><a href="https://github.com/containerd/nerdctl"  target="_blank" rel="noreferrer">nerdctl (contaiNERD ctl)</a></li>
<li><a href="https://kubernetes.io/"  target="_blank" rel="noreferrer">Kubernetes</a></li>
</ul>

<h2 class="relative group">Resources
    <div id="resources" class="anchor"></div>
    
</h2>
<ul>
<li><a href="https://docs.docker.com/engine/install/"  target="_blank" rel="noreferrer">Install | Docker Docs</a></li>
<li><a href="https://docs.docker.com/engine/install/linux-postinstall/"  target="_blank" rel="noreferrer">Post-installation steps | Docker Docs</a></li>
<li><a href="https://github.com/docker/docker-install"  target="_blank" rel="noreferrer">GitHub - docker/docker-install: Docker installation script</a></li>
<li><a href="https://learn.microsoft.com/en-us/windows/wsl/install"  target="_blank" rel="noreferrer">Install WSL | Microsoft Learn</a></li>
</ul>
<hr>
<p><em>Featured image by <a href="https://unsplash.com/@carrier_lost?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Ian Taylor</a> on <a href="https://unsplash.com/photos/blue-and-red-cargo-ship-on-sea-during-daytime-jOqJbvo1P9g?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Unsplash</a>.</em></p>
]]></content><author><name>Ro'i Bandel</name></author><category term="docker" label="Docker" scheme="https://www.towerofkubes.com/tags/docker/"/><category term="guide" label="Guide" scheme="https://www.towerofkubes.com/tags/guide/"/><category term="snippets" label="Snippets" scheme="https://www.towerofkubes.com/tags/snippets/"/><published>2025-10-16T00:00:00Z</published></entry><entry><title>Git Setup for Windows and WSL</title><link rel="alternate" type="text/html" hreflang="en" href="https://www.towerofkubes.com/articles/git-setup-for-windows-and-wsl/"/><id>https://www.towerofkubes.com/articles/git-setup-for-windows-and-wsl/</id><updated>2025-10-16T00:00:00Z</updated><summary type="html">Configure Git once for both Windows and WSL: install Git and GCM, reuse your .gitconfig, and enable seamless credential handling across environments.</summary><content type="html"><![CDATA[
<h2 class="relative group">Introduction
    <div id="introduction" class="anchor"></div>
    
</h2>
<p>Setting up Git correctly on both <strong>Windows</strong> and <strong>WSL</strong> is essential for a smooth development workflow, especially in environments where you switch between the two.</p>

<h3 class="relative group">This guide ensures
    <div id="this-guide-ensures" class="anchor"></div>
    
</h3>
<ul>
<li><strong>Consistency</strong> – Your Git configuration and credentials work the same way in Windows and WSL, avoiding conflicts or repeated prompts.</li>
<li><strong>Security</strong> – By using <a href="https://github.com/git-ecosystem/git-credential-manager"  target="_blank" rel="noreferrer"><strong>Git Credential Manager (GCM)</strong></a> from Windows inside WSL, you get secure token storage without duplicating credentials.</li>
<li><strong>Efficiency</strong> – No need to manage separate credential helpers or manually sync <code>.gitconfig</code> files between systems.</li>
</ul>
<p>Follow these steps to install Git, configure it properly, and enable seamless authentication across both environments.</p>

<h2 class="relative group">Git for Windows Setup
    <div id="git-for-windows-setup" class="anchor"></div>
    
</h2>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>Note</span>
      </div>
      <div class="admonition-content">
        <p>These commands all need to run in Windows PowerShell.</p>
      </div>
    </div>
<h3 class="relative group">1. Install Git for Windows. Git for Windows can be installed with the following command
    <div id="1-install-git-for-windows-git-for-windows-can-be-installed-with-the-following-command" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="n">winget</span> <span class="n">install</span> <span class="n">-e</span> <span class="p">-</span><span class="n">-id</span> <span class="n">Git</span><span class="p">.</span><span class="py">Git</span> <span class="p">-</span><span class="n">-source</span><span class="p">=</span><span class="n">winget</span></span></span></code></pre></div></div>

    <div class="admonition tip">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M272 384c9.6-31.9 29.5-59.1 49.2-86.2c0 0 0 0 0 0c5.2-7.1 10.4-14.2 15.4-21.4c19.8-28.5 31.4-63 31.4-100.3C368 78.8 289.2 0 192 0S16 78.8 16 176c0 37.3 11.6 71.9 31.4 100.3c5 7.2 10.2 14.3 15.4 21.4c0 0 0 0 0 0c19.8 27.1 39.7 54.4 49.2 86.2l160 0zM192 512c44.2 0 80-35.8 80-80l0-16-160 0 0 16c0 44.2 35.8 80 80 80zM112 176c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-61.9 50.1-112 112-112c8.8 0 16 7.2 16 16s-7.2 16-16 16c-44.2 0-80 35.8-80 80z"/></svg>
        <span>Tip</span>
      </div>
      <div class="admonition-content">
        <p>If you need Git LFS, also run the following command:</p>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="n">winget</span> <span class="n">install</span> <span class="n">-e</span> <span class="p">-</span><span class="n">-id</span> <span class="n">GitHub</span><span class="p">.</span><span class="py">GitLFS</span> <span class="p">-</span><span class="n">-source</span><span class="p">=</span><span class="n">winget</span></span></span></code></pre></div></div>
      </div>
    </div>
<h3 class="relative group">2. Verify installation of Git for Windows (including Git Credentials Manager) with the following command
    <div id="2-verify-installation-of-git-for-windows-including-git-credentials-manager-with-the-following-command" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="n">git</span> <span class="p">-</span><span class="n">-version</span><span class="p">;</span> <span class="n">git</span> <span class="nb">credential-manager</span> <span class="p">-</span><span class="n">-version</span></span></span></code></pre></div></div>

<h3 class="relative group">3. Set your Git email and username
    <div id="3-set-your-git-email-and-username" class="anchor"></div>
    
</h3>

    <div class="admonition tip">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M272 384c9.6-31.9 29.5-59.1 49.2-86.2c0 0 0 0 0 0c5.2-7.1 10.4-14.2 15.4-21.4c19.8-28.5 31.4-63 31.4-100.3C368 78.8 289.2 0 192 0S16 78.8 16 176c0 37.3 11.6 71.9 31.4 100.3c5 7.2 10.2 14.3 15.4 21.4c0 0 0 0 0 0c19.8 27.1 39.7 54.4 49.2 86.2l160 0zM192 512c44.2 0 80-35.8 80-80l0-16-160 0 0 16c0 44.2 35.8 80 80 80zM112 176c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-61.9 50.1-112 112-112c8.8 0 16 7.2 16 16s-7.2 16-16 16c-44.2 0-80 35.8-80 80z"/></svg>
        <span>Tip</span>
      </div>
      <div class="admonition-content">
        <p>If you are using GitHub, you can use your GitHub username and the “no-reply” email address from <a href="https://github.com/settings/emails"  target="_blank" rel="noreferrer">GitHub Email settings</a>.</p>
      </div>
    </div><div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="nv">$env:GIT_EMAIL</span> <span class="p">=</span> <span class="s2">"your-git-email"</span></span></span></code></pre></div></div>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="nv">$env:GIT_USER</span>  <span class="p">=</span> <span class="s2">"your-git-username"</span></span></span></code></pre></div></div>

<h3 class="relative group">4. Run the following commands to set initial settings for <code>.gitconfig</code>
    <div id="4-run-the-following-commands-to-set-initial-settings-for-gitconfig" class="anchor"></div>
    
</h3>

    <div class="admonition tip">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M272 384c9.6-31.9 29.5-59.1 49.2-86.2c0 0 0 0 0 0c5.2-7.1 10.4-14.2 15.4-21.4c19.8-28.5 31.4-63 31.4-100.3C368 78.8 289.2 0 192 0S16 78.8 16 176c0 37.3 11.6 71.9 31.4 100.3c5 7.2 10.2 14.3 15.4 21.4c0 0 0 0 0 0c19.8 27.1 39.7 54.4 49.2 86.2l160 0zM192 512c44.2 0 80-35.8 80-80l0-16-160 0 0 16c0 44.2 35.8 80 80 80zM112 176c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-61.9 50.1-112 112-112c8.8 0 16 7.2 16 16s-7.2 16-16 16c-44.2 0-80 35.8-80 80z"/></svg>
        <span>Tip</span>
      </div>
      <div class="admonition-content">
        <p>These settings help avoid common git warnings.</p>
      </div>
    </div><div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-powershell" data-lang="powershell"><span class="line"><span class="cl"><span class="n">git</span> <span class="n">config</span> <span class="p">-</span><span class="n">-global</span> <span class="n">color</span><span class="p">.</span><span class="py">ui</span> <span class="s2">"auto"</span>
</span></span><span class="line"><span class="cl"><span class="n">git</span> <span class="n">config</span> <span class="p">-</span><span class="n">-global</span> <span class="n">init</span><span class="p">.</span><span class="py">defaultBranch</span> <span class="s2">"main"</span>
</span></span><span class="line"><span class="cl"><span class="n">git</span> <span class="n">config</span> <span class="p">-</span><span class="n">-global</span> <span class="n">user</span><span class="p">.</span><span class="py">email</span> <span class="s2">"</span><span class="nv">$env:GIT_EMAIL</span><span class="s2">"</span>
</span></span><span class="line"><span class="cl"><span class="n">git</span> <span class="n">config</span> <span class="p">-</span><span class="n">-global</span> <span class="n">user</span><span class="p">.</span><span class="py">name</span>  <span class="s2">"</span><span class="nv">$env:GIT_USER</span><span class="s2">"</span></span></span></code></pre></div></div>

<h2 class="relative group">Git on WSL Setup
    <div id="git-on-wsl-setup" class="anchor"></div>
    
</h2>

    <div class="admonition note">
      <div class="admonition-header"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>
        <span>Note</span>
      </div>
      <div class="admonition-content">
        <p>These commands all need to run in WSL.</p>
      </div>
    </div>
<h3 class="relative group">1. Install git and git-lfs packages. On Debian/Ubuntu
    <div id="1-install-git-and-git-lfs-packages-on-debianubuntu" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt-get update <span class="o">&&</span> sudo apt-get install git git-lfs</span></span></code></pre></div></div>

<h3 class="relative group">2. Verify installation of Git and Git LFS
    <div id="2-verify-installation-of-git-and-git-lfs" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git --version <span class="o">&&</span> git lfs --version</span></span></code></pre></div></div>

<h3 class="relative group">3. Copy your existing <code>.gitconfig</code> file from Windows
    <div id="3-copy-your-existing-gitconfig-file-from-windows" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">cp <span class="s2">"</span><span class="k">$(</span>wslpath -a <span class="s2">"</span><span class="k">$(</span>cmd.exe /c <span class="s2">"<nul set /p x=%USERPROFILE%\.gitconfig"</span><span class="k">)</span><span class="s2">"</span><span class="k">)</span><span class="s2">"</span> <span class="s2">"</span><span class="si">${</span><span class="nv">HOME</span><span class="si">}</span><span class="s2">/.gitconfig"</span></span></span></code></pre></div></div>

<h3 class="relative group">4. Configure Git Credentials Manager
    <div id="4-configure-git-credentials-manager" class="anchor"></div>
    
</h3>
<div class="highlight-wrapper"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git config --global credential.helper <span class="s2">"</span><span class="k">$(</span>wslpath -a <span class="s2">"</span><span class="k">$(</span>powershell.exe -NoProfile -Command <span class="s2">"Write-Host -NoNewline (Join-Path ((Get-Item (git --exec-path)).Parent.Parent.FullName) 'bin\git-credential-manager.exe')"</span><span class="k">)</span><span class="s2">"</span><span class="k">)</span><span class="s2">"</span></span></span></code></pre></div></div>
<hr>
<p><em>Featured image by <a href="https://unsplash.com/@6heinz3r?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Gabriel Heinzer</a> on <a href="https://unsplash.com/photos/a-close-up-of-a-computer-screen-with-a-bunch-of-words-on-it-EUzk9BIEq6M?utm_source=hugo&utm_medium=referral"  target="_blank" rel="noreferrer">Unsplash</a>.</em></p>
]]></content><author><name>Ro'i Bandel</name></author><category term="git" label="Git" scheme="https://www.towerofkubes.com/tags/git/"/><category term="guide" label="Guide" scheme="https://www.towerofkubes.com/tags/guide/"/><category term="snippets" label="Snippets" scheme="https://www.towerofkubes.com/tags/snippets/"/><published>2025-10-16T00:00:00Z</published></entry></feed>