AI can fly !!

AI がやりたい Web エンジニアのアウトプット (AI の知識は無い)

【Git】インストール・アップデート時の設定まとめ【Windows】

git-logo

はじめに

普段 Windows で Git を使用しているのですが、 Git のアップデートをインストーラから行うときの設定を毎度忘れて調べているので、備忘録としてまとめました。
アップデートに限らず、インストーラから新規でインストールする際も同様になります。

動作環境

OS
Windows 10 Pro
Application Version
Git 2.26.0

Git のインストール・アップデート時の設定

1. Select Components

Select Components

  • Additional icons
    • On the Desktop
      • Git Bashを起動するショートカットの作成
  • Windows Explorer integration
  • Git LFS (Large File Support)
    • LFSのインストール有無
  • Associate .git* configuration files with the default text editor
  • Associate .sh files to be run with Bash
    • 拡張子が sh で始まるファイルを Git Bash で実行する
  • Use a TrueType font in all console windows
    • 全てのコンソールウィンドウのフォントを変更
  • Check daily for Git for Windows updates
    • Git for windows のアップデートを毎日確認する

注意

※ Use a TrueType font in all console windows は、文字化けの可能性があるため有効化しない方がいいらしい。

2. Choosing the default editor used by Git

Choosing the default editor used by Git

3. Adjusting your PATH environment

Adjusting your PATH environment

  • Use Git from Git Bash only
    • 環境変数( Path )には何も追加しない
    • Git Bash でのみ Git コマンドが使用可
  • Git from the command line and also from 3rd-party software
    • 環境変数( Path )へ、 C:\Program Files\Git\cmd を追加
    • Git コマンドが Git Bash 以外のコンソールでも使用可
  • Use Git and optional Unix tools from the Command Prompt
    • 環境変数( Path )へ、 C:\Program Files\Git\cmdC:\Program Files\Git\mingw64\binC:\Program Files\Git\usr\bin を追加
    • Git コマンド以外の Unix 系コマンドが Git Bash 以外のコンソールでも使用可

注意

Use Git and optional Unix tools from the Command Prompt を選択した場合、 Windows の既存のコマンドにも影響を与える可能性があるため、上の二ついずれかを選択した方が無難。

4. Choosing HTTPS transport backend

Choosing HTTPS transport backend

5. Configuring the line ending conversions

Configuring the line ending conversions

  • Checkout Windows-style, commit Unix-style line endings
    • チェックアウト時に改行コードを LF から CRLF に変換し、コミット時に CRLFLF に変換する
    • システム全体の Git 設定ファイルに core.autocrlf=true を設定
    • Windows 環境で推奨
  • Checkout as-is, commit Unix-style line endings
    • チェックアウト時は改行コードを変更せず、コミット時に CRLFLF に変換する
    • システム全体の Git 設定ファイルに core.autocrlf=input を設定
    • Unix 環境で推奨
  • Checkout as-is, commit as-is
    • チェックアウト時・コミット時共に改行コードを変更しない
    • システム全体の Git 設定ファイルに core.autocrlf=false を設定
    • クロスプラットフォームプロジェクトでは非推奨

6. Configuring the terminal emulator to use with Git Bash

Configuring the terminal emulator to use with Git Bash

7. Configuring extra options

Configuring extra options

  • Enable file system caching
    • メモリリソースを使用し、キャッシュを有効化
    • システム全体の Git 設定ファイルに core.fscache=true を設定
  • Enable Git Credential Manager
    • リモートリポジトリにアクセスする際の認証情報を Windows の資格情報マネージャに保存
    • GitHub の二段階認証にも対応
  • Enable symbolic links
    • シンボリック・リンクを有効化

おわりに

Git をアップデートする時は、インストールと同じ設定フローを通るのではなく、現在の設定を引き継いで一発で Git 本体だけをアップデートできたならいいなといつも思います。
でも、そうすると新しい環境に新規でインストールする時に設定を完全に忘れていそう…

現状はアップデートの度に設定を見直すことになるので、これはこれでアリなのかもしれませんね。

バージョン 2.26 あたりから Only show new options という項目がインストーラの画面に追加されているのですが、バージョンアップで新規に追加された項目だけを表示するような設定なのでしょうか。
誰か知っている方教えてください!