■インストーラダウンロード https://github.com/git/git/downloads [root@redmine01 ~]# ll /usr/local/ 合計 80 drwxr-xr-x 2 root root 4096 9月 25 00:19 bin drwxr-xr-x 2 root root 4096 5月 11 20:58 etc drwxr-xr-x 2 root root 4096 5月 11 20:58 games drwxr-xr-x 2 root root 4096 5月 11 20:58 include drwxr-xr-x 3 root root 4096 9月 24 23:27 lib drwxr-xr-x 2 root root 4096 5月 11 20:58 lib64 drwxr-xr-x 2 root root 4096 5月 11 20:58 libexec drwxr-xr-x 2 root root 4096 5月 11 20:58 sbin drwxr-xr-x 4 root root 4096 9月 24 05:19 share drwxr-xr-x 2 root root 4096 5月 11 20:58 src [root@redmine01 ~]# cd /home/public/src/ [root@redmine01 src]# tar -zxf git-git-v1.7.6.1-0-gccef604.tar.gz [root@redmine01 src]# cd git-git-ce54b9b/ ⇒./configureがないので、いきなりmake [root@redmine01 git-git-ce54b9b]# make prefix=/usr/local GIT_VERSION = 1.7.6.1 * new build flags or prefix CC daemon.o * new link flags CC abspath.o (中略) GEN bin-wrappers/test-svn-fe GEN bin-wrappers/test-treap [root@redmine01 git-git-ce54b9b]# ⇒make install [root@redmine01 git-git-ce54b9b]# make prefix=/usr/local install * new build flags or prefix CC daemon.o CC abspath.o (中略) cp "$execdir/git-remote-http" "$execdir/$p" || exit; \ done && \ ./check_bindir "z$bindir" "z$execdir" "$bindir/git-add" [root@redmine01 git-git-ce54b9b]# ■bareリポジトリ(共有リポジトリ)作成 [root@redmine01 ~]# mkdir -p /opt/git_repos/sample [root@redmine01 ~]# cd /opt/git_repos/sample [root@redmine01 sample]# git init --bare --shared=true Initialized empty shared Git repository in /opt/git_repos/sample/ [root@redmine01 sample]# git branch [root@redmine01 sample]# ※作成直後はブランチは存在しない。 ⇒所有者変更 [root@redmine01 ~]# chown -R public: /opt/git_repos/sample [root@redmine01 ~]# ll /opt/git_repos/sample 合計 32 -rw-rw-r-- 1 public public 23 9月 25 21:35 HEAD drwxrwsr-x 2 public public 4096 9月 25 21:35 branches -rw-rw-r-- 1 public public 126 9月 25 21:35 config -rw-rw-r-- 1 public public 73 9月 25 21:35 description drwxrwsr-x 2 public public 4096 9月 25 21:35 hooks drwxrwsr-x 2 public public 4096 9月 25 21:35 info drwxrwsr-x 4 public public 4096 9月 25 21:35 objects drwxrwsr-x 4 public public 4096 9月 25 21:35 refs [root@redmine01 ~]# ----------------------------------------------------------- ◆クライアントPC(Windows7)にて、msysgitインストール ⇒msysgitダウンロード http://code.google.com/p/msysgit/downloads/list Git-1.7.6-preview20110708.exe ⇒インストール ウィザードに従ってインストール。選択肢は下記を選択 ・Use Git Bash only ・Ceckout Windows-style, commit Unix-style line endings ◆クライアントPC(Windows7)にて、msysgitを利用し対象ディレクトリをバージョン管理する Welcome to Git (version 1.7.6-preview20110708) Run 'git help git' to display the help index. Run 'git help' to display help for specific commands. admin@TANYAO-PC /E/git_reops/test ⇒対象ディレクトリをgitでソース管理 $ git init Initialized empty Git repository in e:/git_reops/test/.git/ admin@TANYAO-PC /E/git_reops/test (master) ⇒リモートの共有リポジトリをoriginという名前で定義 $ git remote add origin ssh://public@192.168.1.15/opt/git_repos/sample admin@TANYAO-PC /E/git_reops/test (master) ⇒ユーザ名とメールアドレスを設定 $ git config --global user.name "tanyao" admin@TANYAO-PC /E/git_reops/test (master) $ git config --global user.email admin@tanyao.dynalias.net admin@TANYAO-PC /E/git_reops/test (master) ⇒全ファイルをステージングに追加 $ git add . warning: LF will be replaced by CRLF in .gitignore. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in Gemfile. (後略) admin@TANYAO-PC /E/git_reops/test (master) ⇒コミット $ git commit -m "initial import" [master (root-commit) 40b0767] initial import warning: LF will be replaced by CRLF in .gitignore. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in Gemfile. The file will have its original line endings in your working directory. (後略) admin@TANYAO-PC /E/git_reops/test (master) ⇒共有リポジトリにプッシュ $ git push origin master public@192.168.1.15's password: Counting objects: 87, done. Compressing objects: 100% (74/74), done. Writing objects: 100% (87/87), 29.65 KiB, done. Total 87 (delta 2), reused 0 (delta 0) To ssh://public@192.168.1.15/opt/git_repos/sample * [new branch] master -> master admin@TANYAO-PC /E/git_reops/test (master) ----------------------------------------------------------- ■クライアントPC(Windows7)からpush後、再確認 [root@redmine01 sample]# git branch * master [root@redmine01 sample]# ll 合計 32 -rw-rw-r-- 1 public public 23 9月 25 21:35 HEAD drwxrwsr-x 2 public public 4096 9月 25 21:35 branches -rw-rw-r-- 1 public public 126 9月 25 21:35 config -rw-rw-r-- 1 public public 73 9月 25 21:35 description drwxrwsr-x 2 public public 4096 9月 25 21:35 hooks drwxrwsr-x 2 public public 4096 9月 25 21:35 info drwxrwsr-x 79 public public 4096 9月 25 21:46 objects ←ファイルが増えている drwxrwsr-x 4 public public 4096 9月 25 21:35 refs [root@redmine01 sample]# ll objects/ 合計 308 drwxrwsr-x 2 public public 4096 9月 25 21:46 04 drwxrwsr-x 2 public public 4096 9月 25 21:46 05 drwxrwsr-x 2 public public 4096 9月 25 21:46 08 drwxrwsr-x 2 public public 4096 9月 25 21:46 0a drwxrwsr-x 2 public public 4096 9月 25 21:46 11 (後略) ■devブランチ作成 [root@redmine01 sample]# git branch dev [root@redmine01 sample]# git branch dev * master [root@redmine01 sample]# git checkout dev fatal: This operation must be run in a work tree [root@redmine01 sample]# ※bareリポジトリではmaster以外のブランチに移動できないようだ。 ----------------------------------------------------------- ◆クライアントPC(Windows7)にて、共有リポジトリをプル $ git pull public@192.168.1.15's password: From ssh://192.168.1.15/opt/git_repos/sample * [new branch] dev -> origin/dev You asked me to pull without telling me which branch you want to merge with, and 'branch.master.merge' in your configuration file does not tell me, either. Please specify which branch you want to use on the command line and try again (e.g. 'git pull '). See git-pull(1) for details. If you often merge with the same branch, you may want to use something like the following in your configuration file: [branch "master"] remote = merge = [remote " "] url = fetch = See git-config(1) for details. admin@TANYAO-PC /E/git_reops/test (master) ⇒リモートブランチからローカルブランチを生成 $ git branch -a * master remotes/origin/dev remotes/origin/master admin@TANYAO-PC /E/git_reops/test (master) $ git checkout -b dev origin/dev Branch dev set up to track remote branch dev from origin. Switched to a new branch 'dev' admin@TANYAO-PC /E/git_reops/test (dev) $ git branch -a * dev master remotes/origin/dev remotes/origin/master admin@TANYAO-PC /E/git_reops/test (dev)
2011年9月26日月曜日
CentOS5.7にgit1.7.6.1インストール
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿