{"id":2640,"date":"2018-08-11T11:12:49","date_gmt":"2018-08-11T02:12:49","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=2640"},"modified":"2025-04-25T15:36:21","modified_gmt":"2025-04-25T06:36:21","slug":"git-lf-would-be-replaced-by-crlf-%e3%82%a8%e3%83%a9%e3%83%bc","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/2640","title":{"rendered":"[git] LF would be replaced by CRLF \u30a8\u30e9\u30fc"},"content":{"rendered":"<h3>\u75c7\u72b6<\/h3>\n<p>\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3078\u306e\u30d5\u30a1\u30a4\u30eb\u8ffd\u52a0 (git add) \u306b\u304a\u3044\u3066 &quot;<strong>LF would be replaced by CRLF in xxx<\/strong>&quot; \u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u5931\u6557\u3059\u308b\u3002<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<\/p>\n<h3>\u30a8\u30e9\u30fc\u767a\u751f\u4f8b<\/h3>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git add readme.txt\r\nfatal: LF would be replaced by CRLF in readme.txt<\/pre>\n<pre class=\"lang:default highlight:0 decode:true \" >$ git add *.json\r\nfatal: LF would be replaced by CRLF in .vscode\/c_cpp_properties.json<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3001\u80cc\u666f<\/h3>\n<p>\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0 (git add) \u3092\u8a66\u307f\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u6539\u884c\u30b3\u30fc\u30c9\u5f62\u5f0f\u304c<strong>LF<\/strong>\u3067\u3042\u3063\u305f\u3002\u3082\u3057\u3001\u3053\u306e\u307e\u307e\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3092\u8a31\u3057\u3066\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u3059\u308b\u3068\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u524d\u306e\u6539\u884c\u30b3\u30fc\u30c9\u5f62\u5f0f\u304c<strong>LF<\/strong>\u3067\u3001\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u5f8c\u306e\u6539\u884c\u30b3\u30fc\u30c9\u5f62\u5f0f\u304c\u81ea\u52d5\u5909\u63db\u306e\u7d50\u679c <strong>CRLF<\/strong>\u3068\u306a\u308a\u4e00\u81f4\u3057\u306a\u3044\u3002\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u524d\u3068\u5f8c\u3067\u30d5\u30a1\u30a4\u30eb\u304c\u4e00\u81f4\u3057\u306a\u3044\uff08\u6539\u884c\u30b3\u30fc\u30c9\u304c\u7570\u306a\u308b\uff09\u306e\u306f &quot;\u5b9c\u3057\u304f\u306a\u3044&quot; \u3002\u305d\u3053\u3067\u3001git add \u30b3\u30de\u30f3\u30c9\u306f\u30a8\u30e9\u30fc\u306b\u5012\u3057\u3066\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3092\u5931\u6557\u3055\u305b\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u89e3\u6c7a\u65b9\u6cd51 : \u6539\u884c\u30b3\u30fc\u30c9\u5f62\u5f0f\u306b\u3053\u3060\u308f\u308a\u306e\u306a\u3044\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u3068\u304d<\/h3>\n<p>\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\uff08\u305f\u3068\u3048\u3070 readme.txt\uff09\u306e\u6539\u884c\u30b3\u30fc\u30c9\u3092CRLF\u5f62\u5f0f\u306b\u5909\u63db\u3057\u305f\u5f8c\u306b\u3001\u3042\u3089\u305f\u3081\u3066\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3092\u8a66\u307f\u308b\u3002\u3053\u3046\u3059\u308b\u3068\u3001\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u524d\u3082\u30c1\u30a7\u30c3\u30af\u30a2\u30a6\u30c8\u5f8c\u3082\u6539\u884c\u30b3\u30fc\u30c9\u5f62\u5f0f\u306fCRLF\u5f62\u5f0f\u3067\u4e00\u81f4\u3059\u308b\u305f\u3081\u3001git add\u30b3\u30de\u30f3\u30c9\u306f\u30a8\u30e9\u30fc\u5224\u5b9a\u3057\u306a\u3044\u3002\u305f\u3060\u3057\u3001git\u30b3\u30de\u30f3\u30c9\u306e\u80cc\u666f\u3067\u306f\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u6295\u5165\u3059\u308b\u3068\u304d\u306b LF\u5f62\u5f0f &rArr; CRLF\u5f62\u5f0f\u3001\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089\u53d6\u308a\u51fa\u3059\u3068\u304d\u306b CRLF\u5f62\u5f0f &rArr; LF\u5f62\u5f0f \u306e\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u304c\u8d70\u3063\u3066\u3044\u308b\u3053\u3068\u306b\u7559\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u7559\u610f\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u3082\u305d\u3082\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u6539\u884c\u30b3\u30fc\u30c9\u5f62\u5f0f\u306b\u3053\u3060\u308f\u308a\u304c\u306a\u3044\u306e\u3067\u3042\u308c\u3070\u60aa\u5f71\u97ff\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>\u89e3\u6c7a\u65b9\u6cd52 : \u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u3092\u56de\u907f\u3057\u305f\u3044\u3068\u304d<\/h3>\n<p>Git\u30ea\u30dd\u30b8\u30c8\u30ea\u3078\u306e\u6295\u5165\uff0f\u53d6\u51fa\u306e\u904e\u7a0b\u3067\u81ea\u52d5\u7684\u306b\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db <strong>LF<\/strong> &#x21D4; <strong>CRLF<\/strong> \u304c\u5b9f\u884c\u3055\u308c\u308b\u3053\u3068\u3092\u907f\u3051\u305f\u3044\u3068\u304d<\/p>\n<h4>1. \u4e00\u90e8\u306e\u30d5\u30a1\u30a4\u30eb\u9650\u5b9a\u3067\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u3092\u56de\u907f\u3059\u308b<\/h4>\n<p>\u305f\u3068\u3048\u3070\u3001\u62e1\u5f35\u5b50 <strong>json<\/strong> \u9650\u5b9a\u3067\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u3092\u56de\u907f\u3059\u308b\u3002\u305f\u3068\u3048\u3070 <code>*.json<\/code> \u306b\u5bfe\u3057\u3066<code>.gitattributes<\/code>\u30d5\u30a1\u30a4\u30eb\u306b\u6b21\u306e\u3088\u3046\u306b <strong>binary\u5c5e\u6027<\/strong> \u3092\u8a2d\u5b9a\u3059\u308b\u3002binary\u5c5e\u6027\u304c\u8a2d\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u7121\u6761\u4ef6\u3067\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u306e\u5bfe\u8c61\u304b\u3089\u5916\u3055\u308c\u308b\u3002\u4e00\u65b9\u3067\u3001EXCEL\u30d5\u30a1\u30a4\u30eb(*.xlsx)\u306a\u3069\u306fbinary\u5c5e\u6027\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u3044\u3070\u3042\u3044\u3067\u3082\u3001git\u304cbinary\u30d5\u30a1\u30a4\u30eb\uff08\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u5bfe\u8c61\u5916\uff09\u3068\u81ea\u52d5\u5224\u5b9a\u3059\u308b\u3002\u81ea\u52d5\u5224\u5b9a\u306e\u7cbe\u5ea6\u304c\u5fc3\u914d\u3067\u3042\u308c\u3070 *.xlsx \u306a\u3069\u306b\u3082binary\u5c5e\u6027\u3092\u8a2d\u5b9a\u3059\u308b\u306e\u304c\u78ba\u5b9f\u3067\u3042\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\".gitattributes\" >*.json binary<\/pre>\n<h4>2. \u5168\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u3092\u56de\u907f\u3059\u308b<\/h4>\n<pre class=\"lang:default decode:true \" >$ git config --local core.autocrlf false<\/pre>\n<p>&nbsp;<\/p>\n<h3>\u88dc\u8db3<\/h3>\n<p>Linux \u3084 MacOS \u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u6539\u884c\u30b3\u30fc\u30c9\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067 LF\u5f62\u5f0f \u3067\u3042\u308b\u3002\u3057\u305f\u304c\u3063\u3066\u4e0a\u8a18\u306e\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u306e\u5bfe\u8c61\u5916\u3067\u3042\u308b\u3002Windows\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u4e0a\u3067\u52d5\u4f5c\u3059\u308b Git \u30c4\u30fc\u30eb \u3060\u3051\u304c\u81ea\u52d5\u6539\u884c\u30b3\u30fc\u30c9\u5909\u63db\u306e\u6a5f\u80fd\u3092\u6709\u3057\u3066\u304a\u308a\u3001\u305d\u306e\u7d50\u679c\u3001\u4ef6\u540d\u306e\u4e0d\u5177\u5408\u304c\u767a\u751f\u3059\u308b\u3070\u3042\u3044\u304c\u3042\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u75c7\u72b6 \u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u3078\u306e\u30d5\u30a1\u30a4\u30eb\u8ffd\u52a0 (git add) \u306b\u304a\u3044\u3066 &quot;LF would be replaced by CRLF in xxx&quot; \u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u5931\u6557\u3059\u308b\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[2],"class_list":["post-2640","post","type-post","status-publish","format-standard","hentry","category-memo","tag-git"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=2640"}],"version-history":[{"count":19,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2640\/revisions"}],"predecessor-version":[{"id":8013,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2640\/revisions\/8013"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=2640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=2640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=2640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}