LoginSignup
26
42

More than 3 years have passed since last update.

Windows10にGitをインストールして初期設定する

Posted at

新しいPCのセットアップするついでに手順メモを記録しておきます。

私のPC

  • Windows10 Pro
  • Ver 1803 Build 17134.829

インストールファイルをダウンロード

ダウンロードサイトのWindowsをクリックしインストール用exeファイルをダウンロードします。
image.png
私はGit-2.22.0-64-bit.exeがダウンロードされましたがPCによっては32bit版など指定してダウンロードが必要かと思います。
image.png

Git for Windowsインストール

exeファイルを実行するとInformation画面が起動しますので[Next]をクリック
image.png
インストール先を指定します。私はデフォルトのままにしました。
image.png
コンポーネント選択画面でインストールする機能を選択します。私はデフォルトのままこのままで[Next]をクリックしました。
image.png
スタートメニューにショートカットを登録します。私はこのままで[Next]クリックしました。
image.png

デフォルトエディターを選択します。VSCodeにしたかったんだけどなぜか変更できなかったのでとりあえずデフォルトのVimにしました。あとからでもこの手順で変更できます…
image.png

コマンドラインでGitをどう使うかのPATH環境設定をします。
私はデフォルトのままで[Next]をクリックしました。
- Use Git Bash only
- Git BashからだけGitが使えるようにする。環境変数に影響なく使える。
- Git from the Command line and also from 3rd-party software
- サードパーティのコマンドラインからもGitが使用できるようにする。デフォルトがこれ。
- Use Git and included Unix tools from the Command Prompt
- gitだけでなく、lsとかUnix系のコマンドもコマンドプロントで使用可能にする
image.png
SSLライブラリ設定をします。これもデフォルトのままで[Next]をクリック。
image.png
改行コード設定。デフォルトは一番上だけどここの記事から真ん中を選択して[Next]
image.png

image.png
GitBash使うときのエミュレーター設定。私はwinpty?ってもの使ってないので[Use Windows' default console window]を選択して[Next]をクリック
その他設定をします。ここの記事からシンボリックリンクは有効にしておいた方がよさそうなので全部チェックして[Next]をクリック
image.png

ん?なんか実験的な機能らしい。有効にしてみよう。選択して[Install]をクリック。
image.png

1,2分でインストールできます。
image.png

コマンドプロンプトでgit --versionを実行してバージョンが出力されたらOKです。
image.png

念のためPCをリブートします。

Git初期設定

スタートの中にあるGit Bashを起動します。
image.png

Gitのユーザー名とアカウント名を設定して設定されたかを確認します。

GitBash
$ git config --global user.name "takeda"
$ git config --global user.email "hogehoge@email.com"
$ git config --list
core.symlinks=true
core.autocrlf=input
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
add.interactive.usebuiltin=true
user.name=takeda
user.email=hogehoge@email.com
26
42
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
42