# 解決TortoiseGit 自動轉換換行符號的問題 ### AutoCrLf 設為 false ; SafeCrLf 設為 true ![image](https://hackmd.io/_uploads/BJiNxQrup.png) ### global.gitconfig ```global.gitconfig= [safe] directory = '*' [credential "https://gitlab.com"] provider = generic [user] name = "" email = "" [core] autocrlf = false safecrlf = true ``` ### 附帶一提: 執行dos2unix做一次性轉換 ``` $ find ./ -type f -print0 | xargs -0 dos2unix -- ``` ``` $ dos2unix --help 用法: dos2unix [選項] [file ...] [-n infile outfile ...] -ascii 只轉換換行字元(預設) -iso 在DOS 和ISO-8859-1 字元集間轉換 -1252 使用Windows 1252 編碼頁(西歐) -437 使用DOS 437 編碼頁(US) (預設) -850 使用DOS 850 編碼頁(西歐) -860 使用DOS 860 編碼頁(葡萄牙) -863 使用DOS 863 編碼頁(加拿大法語) -865 使用DOS 865 編碼頁(北歐) -7 轉換8 位元字元到7 位元空間 -b, --keep-bom keep Byte Order Mark -c, --convmode 轉換模式 convmode ascii, 7bit, iso, mac, 預設為ascii -f, --force 強制轉換二進位檔案 -h, --help 顯示本說明文字 -i, --info[=FLAGS] display file information file ... files to analyze -k, --keepdate 保留輸出檔時間 -L, --license 顯示軟體授權 -l, --newline 加入額外的換行 -m, --add-bom add Byte Order Mark (default UTF-8) -n, --newfile 寫入新檔 infile 新檔模式中的原始檔案 outfile 新檔模式中的輸出檔案 -o, --oldfile 寫入原檔案(預設) file ... 原檔模式中要轉換的檔案 -q, --quiet 安靜模式,抑制所有警告 -r, --remove-bom remove Byte Order Mark (default) -s, --safe 略過二進位檔案(預設) -u, --keep-utf16 keep UTF-16 encoding -ul, --assume-utf16le 假設輸入檔格式為UTF-16LE -ub, --assume-utf16be 假設輸入檔格式為UTF-16BE -v, --verbose verbose operation -F, --follow-symlink 依循符號連結轉換其目標檔案 -R, --replace-symlink 取代符號連結為轉換後的檔案 (原連結目標檔案保持不變) -S, --skip-symlink 保持符號連結及其目標不變(預設) -V, --version 顯示版本號碼 ```