<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>文件名大小写 on 一极乐</title><link>/tags/%E6%96%87%E4%BB%B6%E5%90%8D%E5%A4%A7%E5%B0%8F%E5%86%99/</link><description>Recent content in 文件名大小写 on 一极乐</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><managingEditor>blog4@outlook.com (堃埜)</managingEditor><webMaster>blog4@outlook.com (堃埜)</webMaster><copyright>Copyright © [site_title]</copyright><lastBuildDate>Mon, 16 Dec 2024 15:33:00 +0000</lastBuildDate><atom:link href="/tags/%E6%96%87%E4%BB%B6%E5%90%8D%E5%A4%A7%E5%B0%8F%E5%86%99/index.xml" rel="self" type="application/rss+xml"/><item><title>因为修改文件名大小写 GitLab ,GitHub ,Netlify 报错文件不存，如何让Git识别文件名大小写</title><link>/zh/git-and-github-desktop-recognize-file-name-case/</link><pubDate>Mon, 16 Dec 2024 15:33:00 +0000</pubDate><author>blog4@outlook.com (堃埜)</author><guid>/zh/git-and-github-desktop-recognize-file-name-case/</guid><description>&lt;!-- more -->
&lt;p>发现近期一极乐 push 的 Commit 在 Gitlab 和 Netlify 都没构建，查看一下日志发现 Jekyll 找不到某文件，可是Git 中明明有该文件，仔细对比才想起上次在 Windows 11 中将该文件名中的大写都修改成了小写，别的文件引用时也都使用了小写，然后当时 GitHub Desktop 没有提示 Commit 也并未在意。所以出现了这找不到文件的乌龙事件。&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl"> Generating...
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Jekyll Feed: Generating feed &lt;span class="k">for&lt;/span> posts
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Liquid Exception: Could not locate the included file &lt;span class="s1">&amp;#39;websitestyle.js&amp;#39;&lt;/span> in any of &lt;span class="o">[&lt;/span>&lt;span class="s2">&amp;#34;/builds/yijile/123/project/tampermonkey/script&amp;#34;&lt;/span>&lt;span class="o">]&lt;/span>. Ensure it exists in one of those directories and, &lt;span class="k">if&lt;/span> it is a symlink, does not point outside your site source. in project/tampermonkey/script/config_WebsiteStyle.js
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Windows 11 中的 Git 这点有点坑，其实很多常见都是会识别大小写的。但是它却忽略了，可能就会出现类似问题。分享到一极乐解决方案：让Git识别文件名大小写。也便于下次遇到类似问题时不慌张。&lt;/p>
&lt;h2 id="检查-git-是否识别文件名大小写">检查 Git 是否识别文件名大小写
&lt;/h2>&lt;p>通过 终端 或 CMD 使用以下命令，返回 &lt;code>true&lt;/code> 表示不识别大小写，返回 &lt;code>false&lt;/code> 表示识别大小写&lt;/p>
&lt;p>只查看当前项目 Git 配置&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git config --get core.ignorecase
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>查看全局 Git 配置&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git config --get --global core.ignorecase
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="修改为-git-识别文件名大小写">修改为 Git 识别文件名大小写
&lt;/h2>&lt;p>只修改当前项目&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git config --local core.ignorecase &lt;span class="nb">false&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>修改全局配置&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git config --global core.ignorecase &lt;span class="nb">false&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>修改后你会发现之前修改过文件名的大小写的文件都会出现在 Commit 中。此时只需提交 Commit ，GitLab 、GitHub 、Netlify 构建后便不会报错了。&lt;/p>
&lt;h2 id="注意事项">注意事项
&lt;/h2>&lt;ul>
&lt;li>全局为 false 时不代表当前项目一定为 &lt;code>false&lt;/code> ，所以如果没生效就针对当前项目检查或者修改设置。&lt;/li>
&lt;li>查看当前项目的设置请先通过终端打开当前项目目录&lt;/li>
&lt;/ul>
&lt;h2 id="本文可以解决的问题">本文可以解决的问题
&lt;/h2>&lt;ul>
&lt;li>在 GitHub Desktop 上修改了文件名的大小写不识别更新（Commit）&lt;/li>
&lt;li>在 Git 上修改了文件名的大小写不识别更新（Commit）&lt;/li>
&lt;/ul></description></item></channel></rss>