Gitにチャレンジするための環境構築メモ
構成:
Ubuntu 10.04 Server x86 on VirtualBox
○git をインストール
sudo apt-get install git-core git-daemon-run
○リポジトリ作成
sudo mkdir -p /var/git/project.git
cd /var/git/project.git/
sudo chown user.user .
git --bare init
○git-daemon の設定
sudo vi /etc/sv/git-daemon/run
/usr/lib/git-core/git-daemon --verbose --base-path=/var/cache /var/cache/git
を下記に修正
/usr/lib/git-core/git-daemon --verbose --base-path=/var/git --export-all --enable=receive-pack
http://code.google.com/p/msysgit/ から
PortableGit(PortableGit-1.7.0.2-preview20100309.7z) をダウンロード、展開。
http://www.greenwoodsoftware.com/less/download.html から less(less436w.zip) をダウンロード、展開。
less.exe を PortableGit の bin にコピー
http://www.vector.co.jp/soft/dl/win95/util/se295331.html から nkf(Ver2.0.9) をダウンロード、展開。
nkf.exe を PortableGit の bin にコピー
○git-bash.bat ファイルの修正
msysgitをインストールしたフォルダ/git-bash.batに、以下の3行を追加。
ファイルの先頭からREMが途切れた辺り
set PATH=%PATH%;D:\Program Files\system\terapad
set HOME=D:\Git
cd %HOME%
○msysgitインストール先/etc/inputrc
set convert-meta off
set meta-flag on
set output-meta on
set kanji-code utf-8
○msysgitインストール先/etc/profile
export GIT_EDITOR=terapad
export GIT_PAGER="nkf -s | less"
○ローカルリポジトリ作成(win)
git-bash.bat から操作
D:\git\project
○ダミーファイル作成
touch firstfile
git init
○ローカルの変更をコミット
git commit -m 'test'
○ コミットしたユーザー名の設定
git config --global user.name "user"
git config --global user.email user@user
○master(originブランチ)の設定
なぜか、git://xxx.xxx.xxx.xxx/project.git はうまくいかないので、代わりに
git remote add origin ssh://user@xxx.xxx.xxx.xxx/var/git/project.git
○変更を origin に反映
git push origin master
参考:
せっかちな人のための git 入門 - git をインストールし、共同で開発できる環境を整えるまで : 僕は発展途上技術者