Windows に msysgit の portable 版を使って git 環境を作る
前回、msysgit のインストーラを使って Windows にインストールしたが
インストール不要の Portable 版もあったのでそちらでもやってみる。
http://code.google.com/p/msysgit/downloads/list
から現在最新の
「PortableGit-1.8.4-preview20130916.7z」
をダウンロード。
適当なフォルダを作って、その中に解凍したものを入れるだけ。
今回は
C:\applications\PortableGit-1.8.4
に入れた。
git-bash.bat の編集
Gitの起動は解凍したGitフォルダ直下にある git-bash.bat から行う。
起動時にユーザのホームディレクトリに移動しておきたいので
git-bash.bat をテキストエディタで開き、
最初のコメントアウトの rem 行が途切れた辺りに以下の行を挿入する。
cd %USERPROFILE%
コマンドラインからGitを使うためのパス設定
また、コマンドラインからもgitコマンドを使えるようにするため、環境変数 PATH に以下のパスを追加しておく。
C:\applications\PortableGit-1.8.4\cmd;
Unixコマンドツールを利用したい場合は以下のパスも追加しておく。
C:\applications\PortableGit-1.8.4\bin;
Gitの初期設定
git config コマンドでユーザ設定を行う。
$ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com
~/.gitconfig
にファイルが作成される。
Windows環境下では、Gitは$HOMEディレクトリ(環境変数USERPROFILEで指定)の中の.gitconfigファイルを検索する。
確認
$ git config -l core.symlinks=false core.autocrlf=true color.diff=auto color.status=auto color.branch=auto color.interactive=true pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true user.name=John Doe johndoe@example.com
autocrlf がデフォルトで true になっているので
改行コードを変更しないように false にしておく。
$ git config --global core.autocrlf false