Git - アールメカブ

アールメカブ


Git

Linuxの備忘録

ここを参考にさせてもらった

_ ユーザー情報

git config --global user.name "Your Name"
git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

git commit --amend --author='Your Name <you@example.com>'

_ 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

_ commit

ローカルでの修正を登録する

 [ishida@local]$ git commit -m "hogehoge modified"

_ push (by ishida)

ローカルでの作業をサーバーに反映させる

[dev1@local]$ git push origin master

_ clone

git clone ssh://gusers@150.59.**.**/home/gusers/Git/Research.git

_ pull

サーバーから現在のレポジトリをローカルへ反映させる

git pull

_ ローカルファイルを誤って消した場合

[[ ここ: http://uyota.asablo.jp/blog/2008/08/10/3683692]] を参照

$ cd file_dir
$ git checkout master file.name
 
Link: Linuxの備忘録(4487d)
Last-modified: 2010-08-12 (木) 09:25:28 (4999d)