Git のバックアップソース(No.1) - アールメカブ

アールメカブ


Git のバックアップソース(No.1)

[[Linuxの備忘録]]

[[ここ:http://taichino.com/memo/1587]]を参考にさせてもらった

gitユーザとグループ作成
 [git@server]$ adduser git
 [git@server]$ usermod -G git taichino  # 自分
 [git@server]$ usermod -G git dev1      # 他の開発者
 [git@server]$ su - git
 [git@server]$ vim ~/.bashrc # umaskを002に設定する
 
# リモートリポジトリ作成
 [git@server]$ mkdir -p /home/git/hoge.git
  # リモートリポジトリ名には.gitを付ける
 [git@server]$ cd /home/git/hoge.git
 [git@server]$ git --bare init
 
# ローカルリポジトリ作成とリモートリポジトリへの登録(by ishida)
 [ishida@local]$ mkdir hoge
 [ishida@local]$ cd hoge
 [ishida@local]$ git init
 [ishida@local]$ echo "Hello git project" > readme
 [ishida@local]$ git add readme
 [ishida@local]$ git commit -m "start project with git"
 [ishida@local]$ git server add origin  ssh://ishida@server/home/git/hoge.git
 [ishida@local]$ git push origin master
 
# cloneとpush (by dev1)
 [dev1@local]$ git clone ssh://dev1@server/home/git/hoge.git
 [dev1@local]$ cd hoge
 [dev1@local]$ vim readme  # 適当に編集
 [dev1@local]$ git add readme
 [dev1@local]$ git commit -m 'modified for pull test'
 [dev1@local]$ git push origin master
 
# pull (by ishida)
 [ishida@local]$ git pull origin master