Contents
git のインストール
$ sudo apt-get install git
userの設定
git commit を設定しないと動かない。
$ git commit --global user.name "Masahiro Tanoue"
$ git commit --global user.email "user@aaa.com"
gitのフォルダ作成
リモートリポジトリの作成
リモートリポジトリ名には.gitを付ける
[masatano@remote]$ mkdir -p /home/masatano/hoge.git
[masatano@remote]$ cd /home/masatano/hoge.git
[masatano@remote]$ git --bare init
ローカルリポジトリの作成とリモートリポジトリへの登録
[localuser@local]$ mkdir hoge
[localuser@local]$ cd hoge
[localuser@local]$ git init
[localuser@local]$ echo "Hello" > test
[localuser@local]$ git add test
[localuser@local]$ git commit -m "start project"
[localuser@local]$ git remote add origin ssh://masatano@remote~/lib/git/hoge.git:port
[localuser@local]$ git push origin master
cloneとpush
[masatano@remote]$ git clone /home/git/hoge.git
[masatano@remote]$ cd hoge
[masatano@remote]$ touch tmp
[masatano@remote]$ git add hoge
[masatano@remote]$ git commit -m "test"
[masatano@remote]$ git remote add origin /home/masatano/hoge.git
[masatano@remote]$ git push origin master
複数人で編集する場合は、こちらを参照。
http://taichino.com/memo/1587