main() blog

プログラムやゲーム、旅、愛する家族について綴っていきます。

【Git】Gitのインストール手順(Git for Mac)

f:id:takezoh_1127:20181119000259p:plain

MacにGitをインストールする場合、以下の3つの方法が代表的なインストール方法となります。

  • Xcodeをインストール
  • 公式ページからダウンロードしてインストール
  • Homebrewでインストール

パッケージ管理はHomebrewを使用しています。
MacPortsなど他のパッケージ管理もありますが、自分が試していないので今回はHomebrewとさせて頂きます。

Xcodeをインストール

Xcode6.1以降であればXcodeをインストールするとCommandLinwe Toolsもインストールされ、
gitもインストールされるようです。

Xcodeインストール後にGitのバージョンを確認してみてください。

以下の様に表示されればGitがインストールされています。

$ git --version
git version 2.17.2 (Apple Git-113)

最新のバージョンや任意のバージョンをインストールする方法は確認していませんが、
もしかすると公式ページやHomebrewでインストールした方が良いかもしれません。

公式サイトからインストールする方法

Git - Downloading Package

f:id:takezoh_1127:20181119001217p:plain

今回は git-2.19.0-intel-universal-mavericks.dmg をダウンロードします。
ダウンロードが完了したらダブルクリックして展開します。

f:id:takezoh_1127:20181119001254p:plain

展開したフォルダのpkgファイルをダブルクリックします。
最近のMacでは Apple に登録されていないアプリケーションを開こうとすると、警告ダイアログが表示されます。

f:id:takezoh_1127:20181119001402p:plain

この場合は「セキュリティとプライバシー」環境設定の「一般」パネルで「このまま開く」ボタンをクリックすることで、
ブロックされたアプリケーションの例外を許可することもできます。

f:id:takezoh_1127:20181119001508p:plain

f:id:takezoh_1127:20181119001521p:plain

「このまま開く」を押すとインストールが開始されます。

f:id:takezoh_1127:20181119001629p:plain

インストール先を選択します。
変更する必要がなければそのままインストールボタンを押してください。

f:id:takezoh_1127:20181119001654p:plain

f:id:takezoh_1127:20181119001718p:plain

インストールが完了しました。

$ which git
/usr/local/bin/git

/usr/local/bin/git はエイリアスが設定されているので、本当の場所は /usr/local/git/bin/git となります。

フルパスでバージョンを確認するとインストールしたバージョンが確認できます。

$ /usr/local/git/bin/git --version
git version 2.19.0

PATHを通してみます。
.bash_profileがあるか確認してみましょう。

$ cd ~
$ ls -al

無ければ新規にファイルを作成します。

.bash_profileに以下を追加します。

PATH=/usr/local/git/bin:$PATH
export PATH

再度 git のバージョンを確認してみましょう。

$ git --version
git version 2.19.0

公式サイトからインストールしたgitが使われるようになりました。

Homebrewでインストールする

Homebrew で Git をインストールしてみます。

Homebrew のインストール方法は下記を参考にしてください。

www.main-function.com

ターミナルのコマンドラインから '$ brew install git' を実行します。

$ brew install git
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
fx
==> Updated Formulae
abcm2ps                                  kitchen-sync
abyss                                    knot
amqp-cpp                                 kobalt
angular-cli                              kotlin
annie                                    kube-aws
ark                                      lego
asdf                                     libcec
aws-sdk-cpp                              libimagequant
azure-storage-cpp                        libqalculate
ballerina                                librealsense
binaryen                                 librsvg
bundletool                               libsass
caddy                                    libuv
certbot                                  libxlsxwriter
chakra                                   lmod
chamber                                  mandoc
checkbashisms                            mariadb@10.2
chronograf                               maxwell
circleci                                 micronaut
clang-format                             mill
clojurescript                            mongodb
conan                                    mpd
configen                                 mysqltuner
console_bridge                           nailgun
consul                                   node
convox                                   node-build
crystal-icr                              nodeenv
curaengine                               openapi-generator
ddgr                                     opencv@2
diffoscope                               opus-tools
dnscrypt-proxy                           osrm-backend
docfx                                    paket
docker-machine-completion                parallelstl
dscanner                                 passenger
duo_unix                                 phpunit
editorconfig                             picard-tools
elasticsearch                            pipenv
emscripten                               poppler
erlang                                   pre-commit
erlang@18                                pulumi
erlang@20                                pumba
exploitdb                                pygobject3
fio                                      rabbitmq
fluxctl                                  range-v3
fmt                                      restic
fn                                       root
fruit                                    rst-lint
gimme                                    selenium-server-standalone
git-archive-all                          shadowsocks-libev
git-quick-stats                          shc
git-subrepo                              sleuthkit
gitbucket                                smimesign
gitlab-gem                               sonarqube
glslang                                  sratoolkit
go-bindata                               statik
goreleaser                               stern
gradio                                   stgit
grafana                                  sysdig
grpc                                     tcpreplay
grunt-completion                         teleport
gupnp-av                                 terraform_landscape
gwyddion                                 tile38
hapi-fhir-cli                            topgrade
hcloud                                   tree
hunspell                                 tty-solitaire
imageoptim-cli                           tunnel
influxdb                                 uhd
innotop                                  urdfdom_headers
instead                                  vagrant-completion
jenkins                                  vault
jetty                                    vegeta
jfrog-cli-go                             weaver
juju                                     wireguard-tools
just                                     xsimd
kallisto                                 yamllint
kibana@5.6                               zimg
==> Renamed Formulae
mat -> mat2

Error: The following directories are not writable by your user:
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7

なにやらエラーが出てしまいました。

$ 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 or file an issue; just ignore this. Thanks!

Warning: The following directories are not writable by your user:
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/share/man/man3/*

以下のディレクトリの書き込みに失敗しているようです。

/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7

ディレクトリの権限を確認してみましょう。

$ ls -al /usr/local/share/man/
total 0
drwxr-xr-x    6 takezoh  admin   192 11 18 21:21 .
drwxrwxr-x    6 takezoh  admin   192 11 13 23:05 ..
drwxr-xr-x  158 takezoh  admin  5056 11 18 21:21 man1
drwxr-xr-x    3 root     wheel    96 11 18 21:21 man3
drwxr-xr-x    8 root     wheel   256 11 18 21:21 man5
drwxr-xr-x   15 root     wheel   480 11 18 21:21 man7

確かにオーナーの権限が root になっているようです。
ですので以下のコマンドでオーナーの権限を変更してあげます。

$ sudo chown -R $(whoami) /usr/local/share/man/
Password:

変更されていることが確認できました。

$ ls -al /usr/local/share/man/
total 0
drwxr-xr-x    6 takezoh  admin   192 11 18 21:21 .
drwxrwxr-x    6 takezoh  admin   192 11 13 23:05 ..
drwxr-xr-x  158 takezoh  admin  5056 11 18 21:21 man1
drwxr-xr-x    3 takezoh  wheel    96 11 18 21:21 man3
drwxr-xr-x    8 takezoh  wheel   256 11 18 21:21 man5
drwxr-xr-x   15 takezoh  wheel   480 11 18 21:21 man7

再度インストールを実行します。

$ brew install git
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.high_sierr
######################################################################## 100.0%
==> Pouring gettext-0.19.8.1.high_sierra.bottle.tar.gz
==> Caveats
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

If you need to have gettext first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile

For compilers to find gettext you may need to set:
  export LDFLAGS="-L/usr/local/opt/gettext/lib"
  export CPPFLAGS="-I/usr/local/opt/gettext/include"

==> Summary
🍺  /usr/local/Cellar/gettext/0.19.8.1: 1,935 files, 16.9MB
==> Installing git dependency: pcre2
==> Downloading https://homebrew.bintray.com/bottles/pcre2-10.32.high_sierra.bot
######################################################################## 100.0%
==> Pouring pcre2-10.32.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/pcre2/10.32: 224 files, 5.4MB
==> Installing git
==> Downloading https://homebrew.bintray.com/bottles/git-2.19.1.high_sierra.bott
######################################################################## 100.0%
==> Pouring git-2.19.1.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/git
Target /usr/local/bin/git
already exists. You may want to remove it:
  rm '/usr/local/bin/git'

To force the link and overwrite all conflicting files:
  brew link --overwrite git

To list all files that would be deleted:
  brew link --overwrite --dry-run git

Possible conflicting files are:
/usr/local/bin/git -> /usr/local/git/bin/git
/usr/local/bin/git-cvsserver -> /usr/local/git/bin/git-cvsserver
/usr/local/bin/git-shell -> /usr/local/git/bin/git-shell
/usr/local/bin/gitk -> /usr/local/git/bin/gitk
/usr/local/share/man/man1/git-add.1 -> /usr/local/git/share/man/man1/git-add.1
/usr/local/share/man/man1/git-am.1 -> /usr/local/git/share/man/man1/git-am.1
/usr/local/share/man/man1/git-annotate.1 -> /usr/local/git/share/man/man1/git-annotate.1
/usr/local/share/man/man1/git-apply.1 -> /usr/local/git/share/man/man1/git-apply.1
/usr/local/share/man/man1/git-archimport.1 -> /usr/local/git/share/man/man1/git-archimport.1
/usr/local/share/man/man1/git-archive.1 -> /usr/local/git/share/man/man1/git-archive.1
/usr/local/share/man/man1/git-bisect.1 -> /usr/local/git/share/man/man1/git-bisect.1
/usr/local/share/man/man1/git-blame.1 -> /usr/local/git/share/man/man1/git-blame.1
/usr/local/share/man/man1/git-branch.1 -> /usr/local/git/share/man/man1/git-branch.1
/usr/local/share/man/man1/git-bundle.1 -> /usr/local/git/share/man/man1/git-bundle.1
/usr/local/share/man/man1/git-cat-file.1 -> /usr/local/git/share/man/man1/git-cat-file.1
/usr/local/share/man/man1/git-check-attr.1 -> /usr/local/git/share/man/man1/git-check-attr.1
/usr/local/share/man/man1/git-check-ignore.1 -> /usr/local/git/share/man/man1/git-check-ignore.1
/usr/local/share/man/man1/git-check-mailmap.1 -> /usr/local/git/share/man/man1/git-check-mailmap.1
/usr/local/share/man/man1/git-check-ref-format.1 -> /usr/local/git/share/man/man1/git-check-ref-format.1
/usr/local/share/man/man1/git-checkout-index.1 -> /usr/local/git/share/man/man1/git-checkout-index.1
/usr/local/share/man/man1/git-checkout.1 -> /usr/local/git/share/man/man1/git-checkout.1
/usr/local/share/man/man1/git-cherry-pick.1 -> /usr/local/git/share/man/man1/git-cherry-pick.1
/usr/local/share/man/man1/git-cherry.1 -> /usr/local/git/share/man/man1/git-cherry.1
/usr/local/share/man/man1/git-citool.1 -> /usr/local/git/share/man/man1/git-citool.1
/usr/local/share/man/man1/git-clean.1 -> /usr/local/git/share/man/man1/git-clean.1
/usr/local/share/man/man1/git-clone.1 -> /usr/local/git/share/man/man1/git-clone.1
/usr/local/share/man/man1/git-column.1 -> /usr/local/git/share/man/man1/git-column.1
/usr/local/share/man/man1/git-commit-graph.1 -> /usr/local/git/share/man/man1/git-commit-graph.1
/usr/local/share/man/man1/git-commit-tree.1 -> /usr/local/git/share/man/man1/git-commit-tree.1
/usr/local/share/man/man1/git-commit.1 -> /usr/local/git/share/man/man1/git-commit.1
/usr/local/share/man/man1/git-config.1 -> /usr/local/git/share/man/man1/git-config.1
/usr/local/share/man/man1/git-count-objects.1 -> /usr/local/git/share/man/man1/git-count-objects.1
/usr/local/share/man/man1/git-credential-cache--daemon.1 -> /usr/local/git/share/man/man1/git-credential-cache--daemon.1
/usr/local/share/man/man1/git-credential-cache.1 -> /usr/local/git/share/man/man1/git-credential-cache.1
/usr/local/share/man/man1/git-credential-store.1 -> /usr/local/git/share/man/man1/git-credential-store.1
/usr/local/share/man/man1/git-credential.1 -> /usr/local/git/share/man/man1/git-credential.1
/usr/local/share/man/man1/git-cvsexportcommit.1 -> /usr/local/git/share/man/man1/git-cvsexportcommit.1
/usr/local/share/man/man1/git-cvsimport.1 -> /usr/local/git/share/man/man1/git-cvsimport.1
/usr/local/share/man/man1/git-cvsserver.1 -> /usr/local/git/share/man/man1/git-cvsserver.1
/usr/local/share/man/man1/git-daemon.1 -> /usr/local/git/share/man/man1/git-daemon.1
/usr/local/share/man/man1/git-describe.1 -> /usr/local/git/share/man/man1/git-describe.1
/usr/local/share/man/man1/git-diff-files.1 -> /usr/local/git/share/man/man1/git-diff-files.1
/usr/local/share/man/man1/git-diff-index.1 -> /usr/local/git/share/man/man1/git-diff-index.1
/usr/local/share/man/man1/git-diff-tree.1 -> /usr/local/git/share/man/man1/git-diff-tree.1
/usr/local/share/man/man1/git-diff.1 -> /usr/local/git/share/man/man1/git-diff.1
/usr/local/share/man/man1/git-difftool.1 -> /usr/local/git/share/man/man1/git-difftool.1
/usr/local/share/man/man1/git-fast-export.1 -> /usr/local/git/share/man/man1/git-fast-export.1
/usr/local/share/man/man1/git-fast-import.1 -> /usr/local/git/share/man/man1/git-fast-import.1
/usr/local/share/man/man1/git-fetch-pack.1 -> /usr/local/git/share/man/man1/git-fetch-pack.1
/usr/local/share/man/man1/git-fetch.1 -> /usr/local/git/share/man/man1/git-fetch.1
/usr/local/share/man/man1/git-filter-branch.1 -> /usr/local/git/share/man/man1/git-filter-branch.1
/usr/local/share/man/man1/git-fmt-merge-msg.1 -> /usr/local/git/share/man/man1/git-fmt-merge-msg.1
/usr/local/share/man/man1/git-for-each-ref.1 -> /usr/local/git/share/man/man1/git-for-each-ref.1
/usr/local/share/man/man1/git-format-patch.1 -> /usr/local/git/share/man/man1/git-format-patch.1
/usr/local/share/man/man1/git-fsck-objects.1 -> /usr/local/git/share/man/man1/git-fsck-objects.1
/usr/local/share/man/man1/git-fsck.1 -> /usr/local/git/share/man/man1/git-fsck.1
/usr/local/share/man/man1/git-gc.1 -> /usr/local/git/share/man/man1/git-gc.1
/usr/local/share/man/man1/git-get-tar-commit-id.1 -> /usr/local/git/share/man/man1/git-get-tar-commit-id.1
/usr/local/share/man/man1/git-grep.1 -> /usr/local/git/share/man/man1/git-grep.1
/usr/local/share/man/man1/git-gui.1 -> /usr/local/git/share/man/man1/git-gui.1
/usr/local/share/man/man1/git-hash-object.1 -> /usr/local/git/share/man/man1/git-hash-object.1
/usr/local/share/man/man1/git-help.1 -> /usr/local/git/share/man/man1/git-help.1
/usr/local/share/man/man1/git-http-backend.1 -> /usr/local/git/share/man/man1/git-http-backend.1
/usr/local/share/man/man1/git-http-fetch.1 -> /usr/local/git/share/man/man1/git-http-fetch.1
/usr/local/share/man/man1/git-http-push.1 -> /usr/local/git/share/man/man1/git-http-push.1
/usr/local/share/man/man1/git-imap-send.1 -> /usr/local/git/share/man/man1/git-imap-send.1
/usr/local/share/man/man1/git-index-pack.1 -> /usr/local/git/share/man/man1/git-index-pack.1
/usr/local/share/man/man1/git-init-db.1 -> /usr/local/git/share/man/man1/git-init-db.1
/usr/local/share/man/man1/git-init.1 -> /usr/local/git/share/man/man1/git-init.1
/usr/local/share/man/man1/git-instaweb.1 -> /usr/local/git/share/man/man1/git-instaweb.1
/usr/local/share/man/man1/git-interpret-trailers.1 -> /usr/local/git/share/man/man1/git-interpret-trailers.1
/usr/local/share/man/man1/git-log.1 -> /usr/local/git/share/man/man1/git-log.1
/usr/local/share/man/man1/git-ls-files.1 -> /usr/local/git/share/man/man1/git-ls-files.1
/usr/local/share/man/man1/git-ls-remote.1 -> /usr/local/git/share/man/man1/git-ls-remote.1
/usr/local/share/man/man1/git-ls-tree.1 -> /usr/local/git/share/man/man1/git-ls-tree.1
/usr/local/share/man/man1/git-mailinfo.1 -> /usr/local/git/share/man/man1/git-mailinfo.1
/usr/local/share/man/man1/git-mailsplit.1 -> /usr/local/git/share/man/man1/git-mailsplit.1
/usr/local/share/man/man1/git-merge-base.1 -> /usr/local/git/share/man/man1/git-merge-base.1
/usr/local/share/man/man1/git-merge-file.1 -> /usr/local/git/share/man/man1/git-merge-file.1
/usr/local/share/man/man1/git-merge-index.1 -> /usr/local/git/share/man/man1/git-merge-index.1
/usr/local/share/man/man1/git-merge-one-file.1 -> /usr/local/git/share/man/man1/git-merge-one-file.1
/usr/local/share/man/man1/git-merge-tree.1 -> /usr/local/git/share/man/man1/git-merge-tree.1
/usr/local/share/man/man1/git-merge.1 -> /usr/local/git/share/man/man1/git-merge.1
/usr/local/share/man/man1/git-mergetool--lib.1 -> /usr/local/git/share/man/man1/git-mergetool--lib.1
/usr/local/share/man/man1/git-mergetool.1 -> /usr/local/git/share/man/man1/git-mergetool.1
/usr/local/share/man/man1/git-mktag.1 -> /usr/local/git/share/man/man1/git-mktag.1
/usr/local/share/man/man1/git-mktree.1 -> /usr/local/git/share/man/man1/git-mktree.1
/usr/local/share/man/man1/git-mv.1 -> /usr/local/git/share/man/man1/git-mv.1
/usr/local/share/man/man1/git-name-rev.1 -> /usr/local/git/share/man/man1/git-name-rev.1
/usr/local/share/man/man1/git-notes.1 -> /usr/local/git/share/man/man1/git-notes.1
/usr/local/share/man/man1/git-p4.1 -> /usr/local/git/share/man/man1/git-p4.1
/usr/local/share/man/man1/git-pack-objects.1 -> /usr/local/git/share/man/man1/git-pack-objects.1
/usr/local/share/man/man1/git-pack-redundant.1 -> /usr/local/git/share/man/man1/git-pack-redundant.1
/usr/local/share/man/man1/git-pack-refs.1 -> /usr/local/git/share/man/man1/git-pack-refs.1
/usr/local/share/man/man1/git-parse-remote.1 -> /usr/local/git/share/man/man1/git-parse-remote.1
/usr/local/share/man/man1/git-patch-id.1 -> /usr/local/git/share/man/man1/git-patch-id.1
/usr/local/share/man/man1/git-prune-packed.1 -> /usr/local/git/share/man/man1/git-prune-packed.1
/usr/local/share/man/man1/git-prune.1 -> /usr/local/git/share/man/man1/git-prune.1
/usr/local/share/man/man1/git-pull.1 -> /usr/local/git/share/man/man1/git-pull.1
/usr/local/share/man/man1/git-push.1 -> /usr/local/git/share/man/man1/git-push.1
/usr/local/share/man/man1/git-quiltimport.1 -> /usr/local/git/share/man/man1/git-quiltimport.1
/usr/local/share/man/man1/git-range-diff.1 -> /usr/local/git/share/man/man1/git-range-diff.1
/usr/local/share/man/man1/git-read-tree.1 -> /usr/local/git/share/man/man1/git-read-tree.1
/usr/local/share/man/man1/git-rebase.1 -> /usr/local/git/share/man/man1/git-rebase.1
/usr/local/share/man/man1/git-receive-pack.1 -> /usr/local/git/share/man/man1/git-receive-pack.1
/usr/local/share/man/man1/git-reflog.1 -> /usr/local/git/share/man/man1/git-reflog.1
/usr/local/share/man/man1/git-remote-ext.1 -> /usr/local/git/share/man/man1/git-remote-ext.1
/usr/local/share/man/man1/git-remote-fd.1 -> /usr/local/git/share/man/man1/git-remote-fd.1
/usr/local/share/man/man1/git-remote-testgit.1 -> /usr/local/git/share/man/man1/git-remote-testgit.1
/usr/local/share/man/man1/git-remote.1 -> /usr/local/git/share/man/man1/git-remote.1
/usr/local/share/man/man1/git-repack.1 -> /usr/local/git/share/man/man1/git-repack.1
/usr/local/share/man/man1/git-replace.1 -> /usr/local/git/share/man/man1/git-replace.1
/usr/local/share/man/man1/git-request-pull.1 -> /usr/local/git/share/man/man1/git-request-pull.1
/usr/local/share/man/man1/git-rerere.1 -> /usr/local/git/share/man/man1/git-rerere.1
/usr/local/share/man/man1/git-reset.1 -> /usr/local/git/share/man/man1/git-reset.1
/usr/local/share/man/man1/git-rev-list.1 -> /usr/local/git/share/man/man1/git-rev-list.1
/usr/local/share/man/man1/git-rev-parse.1 -> /usr/local/git/share/man/man1/git-rev-parse.1
/usr/local/share/man/man1/git-revert.1 -> /usr/local/git/share/man/man1/git-revert.1
/usr/local/share/man/man1/git-rm.1 -> /usr/local/git/share/man/man1/git-rm.1
/usr/local/share/man/man1/git-send-email.1 -> /usr/local/git/share/man/man1/git-send-email.1
/usr/local/share/man/man1/git-send-pack.1 -> /usr/local/git/share/man/man1/git-send-pack.1
/usr/local/share/man/man1/git-sh-i18n--envsubst.1 -> /usr/local/git/share/man/man1/git-sh-i18n--envsubst.1
/usr/local/share/man/man1/git-sh-i18n.1 -> /usr/local/git/share/man/man1/git-sh-i18n.1
/usr/local/share/man/man1/git-sh-setup.1 -> /usr/local/git/share/man/man1/git-sh-setup.1
/usr/local/share/man/man1/git-shell.1 -> /usr/local/git/share/man/man1/git-shell.1
/usr/local/share/man/man1/git-shortlog.1 -> /usr/local/git/share/man/man1/git-shortlog.1
/usr/local/share/man/man1/git-show-branch.1 -> /usr/local/git/share/man/man1/git-show-branch.1
/usr/local/share/man/man1/git-show-index.1 -> /usr/local/git/share/man/man1/git-show-index.1
/usr/local/share/man/man1/git-show-ref.1 -> /usr/local/git/share/man/man1/git-show-ref.1
/usr/local/share/man/man1/git-show.1 -> /usr/local/git/share/man/man1/git-show.1
/usr/local/share/man/man1/git-stage.1 -> /usr/local/git/share/man/man1/git-stage.1
/usr/local/share/man/man1/git-stash.1 -> /usr/local/git/share/man/man1/git-stash.1
/usr/local/share/man/man1/git-status.1 -> /usr/local/git/share/man/man1/git-status.1
/usr/local/share/man/man1/git-stripspace.1 -> /usr/local/git/share/man/man1/git-stripspace.1
/usr/local/share/man/man1/git-submodule.1 -> /usr/local/git/share/man/man1/git-submodule.1
/usr/local/share/man/man1/git-svn.1 -> /usr/local/git/share/man/man1/git-svn.1
/usr/local/share/man/man1/git-symbolic-ref.1 -> /usr/local/git/share/man/man1/git-symbolic-ref.1
/usr/local/share/man/man1/git-tag.1 -> /usr/local/git/share/man/man1/git-tag.1
/usr/local/share/man/man1/git-unpack-file.1 -> /usr/local/git/share/man/man1/git-unpack-file.1
/usr/local/share/man/man1/git-unpack-objects.1 -> /usr/local/git/share/man/man1/git-unpack-objects.1
/usr/local/share/man/man1/git-update-index.1 -> /usr/local/git/share/man/man1/git-update-index.1
/usr/local/share/man/man1/git-update-ref.1 -> /usr/local/git/share/man/man1/git-update-ref.1
/usr/local/share/man/man1/git-update-server-info.1 -> /usr/local/git/share/man/man1/git-update-server-info.1
/usr/local/share/man/man1/git-upload-archive.1 -> /usr/local/git/share/man/man1/git-upload-archive.1
/usr/local/share/man/man1/git-upload-pack.1 -> /usr/local/git/share/man/man1/git-upload-pack.1
/usr/local/share/man/man1/git-var.1 -> /usr/local/git/share/man/man1/git-var.1
/usr/local/share/man/man1/git-verify-commit.1 -> /usr/local/git/share/man/man1/git-verify-commit.1
/usr/local/share/man/man1/git-verify-pack.1 -> /usr/local/git/share/man/man1/git-verify-pack.1
/usr/local/share/man/man1/git-verify-tag.1 -> /usr/local/git/share/man/man1/git-verify-tag.1
/usr/local/share/man/man1/git-web--browse.1 -> /usr/local/git/share/man/man1/git-web--browse.1
/usr/local/share/man/man1/git-whatchanged.1 -> /usr/local/git/share/man/man1/git-whatchanged.1
/usr/local/share/man/man1/git-worktree.1 -> /usr/local/git/share/man/man1/git-worktree.1
/usr/local/share/man/man1/git-write-tree.1 -> /usr/local/git/share/man/man1/git-write-tree.1
/usr/local/share/man/man1/git.1 -> /usr/local/git/share/man/man1/git.1
/usr/local/share/man/man1/gitk.1 -> /usr/local/git/share/man/man1/gitk.1
/usr/local/share/man/man1/gitremote-helpers.1 -> /usr/local/git/share/man/man1/gitremote-helpers.1
/usr/local/share/man/man1/gitweb.1 -> /usr/local/git/share/man/man1/gitweb.1
/usr/local/share/man/man5/gitattributes.5 -> /usr/local/git/share/man/man5/gitattributes.5
/usr/local/share/man/man5/githooks.5 -> /usr/local/git/share/man/man5/githooks.5
/usr/local/share/man/man5/gitignore.5 -> /usr/local/git/share/man/man5/gitignore.5
/usr/local/share/man/man5/gitmodules.5 -> /usr/local/git/share/man/man5/gitmodules.5
/usr/local/share/man/man5/gitrepository-layout.5 -> /usr/local/git/share/man/man5/gitrepository-layout.5
/usr/local/share/man/man5/gitweb.conf.5 -> /usr/local/git/share/man/man5/gitweb.conf.5
/usr/local/share/man/man7/gitcli.7 -> /usr/local/git/share/man/man7/gitcli.7
/usr/local/share/man/man7/gitcore-tutorial.7 -> /usr/local/git/share/man/man7/gitcore-tutorial.7
/usr/local/share/man/man7/gitcredentials.7 -> /usr/local/git/share/man/man7/gitcredentials.7
/usr/local/share/man/man7/gitcvs-migration.7 -> /usr/local/git/share/man/man7/gitcvs-migration.7
/usr/local/share/man/man7/gitdiffcore.7 -> /usr/local/git/share/man/man7/gitdiffcore.7
/usr/local/share/man/man7/giteveryday.7 -> /usr/local/git/share/man/man7/giteveryday.7
/usr/local/share/man/man7/gitglossary.7 -> /usr/local/git/share/man/man7/gitglossary.7
/usr/local/share/man/man7/gitnamespaces.7 -> /usr/local/git/share/man/man7/gitnamespaces.7
/usr/local/share/man/man7/gitrevisions.7 -> /usr/local/git/share/man/man7/gitrevisions.7
/usr/local/share/man/man7/gitsubmodules.7 -> /usr/local/git/share/man/man7/gitsubmodules.7
/usr/local/share/man/man7/gittutorial-2.7 -> /usr/local/git/share/man/man7/gittutorial-2.7
/usr/local/share/man/man7/gittutorial.7 -> /usr/local/git/share/man/man7/gittutorial.7
/usr/local/share/man/man7/gitworkflows.7 -> /usr/local/git/share/man/man7/gitworkflows.7
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.19.1: 1,518 files, 40.1MB
==> Caveats
==> gettext
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

If you need to have gettext first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile

For compilers to find gettext you may need to set:
  export LDFLAGS="-L/usr/local/opt/gettext/lib"
  export CPPFLAGS="-I/usr/local/opt/gettext/include"

==> git
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git

今度は無事に完了したようです。

PATHを通し直すために .bash_profile も書き換えます。

PATH=/usr/local/Cellar/git/2.19.1/bin:$PATH
export PATH

git のバージョンを確認してみます。

$ /usr/local/Cellar/git/2.19.1/bin/git --version
git version 2.19.1

git の場所も確認してみます。

$ which git
/usr/local/Cellar/git/2.19.1/bin/git

Homebrew での Git のインストールが出来ました。