1.21 jigowatts

Great Scott!

HomebrewでGitをインストールする

概要

13インチのMacBook AirをもらったのでGitの設定をしつつメモ。

環境

macOS Sierra バージョン 10.12.3

Homebrewのインストール

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrew — macOS 用パッケージマネージャー

途中でCommand Line Tools for Xcodeをインストール。

Gitのインストール

$ brew install git
...
==> Summary
🍺  /usr/local/Cellar/git/2.11.1: 1,456 files, 32.4M

現時点ではバージョン2.11.1がインストールされました。
確認してみるとデフォルトでインストールされているGitを参照したまま。

$ git --version
git version 2.10.1 (Apple Git-78)

インストールの問題を確認してみると、パスを変更して優先度を変えてあげる必要があると書いてあります。

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
  git
  git-cvsserver
  git-receive-pack
  git-shell
  git-upload-archive
  git-upload-pack

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
  echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

書いてある通りに.bash_profileにパスを設定して反映してみるとうまくいきました♪

$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
$ source .bash_profile 
$ git --version
git version 2.11.1

Gitの初期設定

名前とメールアドレス、コマンドの出力を読みやすくする設定をする。

$ git config --global user.name "user name"
$ git config --global user.email "user_name@example.com"
$ git config --global color.ui auto

設定の確認。

$ git config --list

ふぃー、今日はここまで。前に一度やってるけど全然覚えてない。。。
それにしてもUSキーボード慣れてないから打ちにくい!でも慣れるときっと使いやすい。きっとそう。