桜ヶ丘日記

技術メモとかとか

さくらVPSでgitをつかってみよう

まずインストール

$ sudo yum -y install git

すんなり入った

ここで~/hogeにレポジトリを作ると仮定する

$ mkdir ~/hoge && cd ~/hoge
$ git init
Initialized empty Git repository in /home/sakuragaoka/hoge/.git/

レポジトリが出来た。
.git/以下にいろいろ入るらしい。

何が作られたんだろ?

$ find .git
.git
.git/objects
.git/objects/pack
.git/objects/info
.git/refs
.git/refs/heads
.git/refs/tags
.git/HEAD
.git/info
.git/info/exclude
.git/branches
.git/description
.git/config
.git/hooks
.git/hooks/applypatch-msg.sample
.git/hooks/prepare-commit-msg.sample
.git/hooks/pre-commit.sample
.git/hooks/pre-applypatch.sample
.git/hooks/post-receive.sample
.git/hooks/post-update.sample
.git/hooks/commit-msg.sample
.git/hooks/post-commit.sample
.git/hooks/pre-rebase.sample
.git/hooks/update.sample

ほう。
よくわかんないけど。

つかってみよう。

$ mkdir ~/work && cd ~/work
$ git clone ~/hoge
Initialized empty Git repository in /home/sakuragaoka/work/hoge/.git/
warning: You appear to have cloned an empty repository.
$ cd hoge

おお。

おっと。ユーザー名とか入れておこう。

$ git config --global user.name "sakuragaoka"
$ git config --global user.email sakuragaoka@example.jp

あとふつうに使うだけ。