Last-modified: 2011-12-30 (金) 03:30:58
Git/CentOSへのインストール

概要

CentOSへGitをインストールします。

手順

  1. Gitをインストールします。
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
      6
    
    -
    |
    !
     
     
     
    
    # yum installできない場合はリポジトリを追加
    # 追加のためにwgetを先にインストール
    yum install wget
    wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
    rpm -Uvh epel-release-5-3.noarch.rpm
    yum install git-core
  2. 初期設定を行ないます。
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
      6
      7
      8
    
    -
    !
    -
    !
    -
    !
    -
    !
    
    # 名前を設定
    git config --global user.name "paburica@hogeServer"
    # アドレス設定
    git config --global user.email "[email protected]"
    # 色設定
    git config --global color.ui auto
    # ページャ設定
    git config --global core.pager "lv -c"

リモートリポジトリへ接続する場合

  1. SSH/接続を簡単にしたいを参考に、~/.ssh/configを編集します。
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
      6
      7
      8
    
    -
    !
    -
    !
    -
    !
    -
    !
    
    # リモートリポジトリ
    Host hub
      # ログインユーザー
      User git
      # ホスト名(名前解決出来ない場合は、ここにアドレスを指定します)
      Hostname 192.200.54.2
      # 秘密鍵のパス
      IdentityFile [秘密鍵のパス]
  2. 完了です。
    Everything is expanded.Everything is shortened.
      1
      2
    
    -
    !
    
    # 以降、以下のようなアドレスでアクセス出来るようになります
    git clone ssh://hub/~git/~

検証時の環境

参考