gitインストールし、レポジトリ作成後にeclipseでSSH接続する

CentOS Eclipse Git Linux

medium_35281615
photo credit: atduskgreg via photopin cc

今回はgitをcentos環境にインストールしてssh経由でelicpseにgit用のプロジェクトを作成してコミットしてみるまでの流れを公開してみます!

centosにgitをインストール

ファイルの取得

$ cd /usr/local/src

rpmforge-releaseファイルの最新版を http://pkgs.repoforge.org/rpmforge-release/ から取得する

$ wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
$ wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

rpmforge-releaseのrpmパッケージインストール

$ rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

gitインストール

$ yum -y --enablerepo=rpmforge install git

レポジトリを作成する

git用のユーザー作成

$ adduser gituser
$ passwd gituser
Password : ****

gituserになった上でレポジトリ作成

$ su - gituser

プロジェクト名をtstciとして/tmp/tstciにgit作業用フォルダを作成する

$ mkdir /tmp/tstci
$ cd /tmp/tstci
$ git init
$ touch test.txt
$ git add .
$ git commit -m "first commit"

/var/reposにレポジトリ用のフォルダを作成してレポジトリを作成する

$ mkdir /var/repos
$ cd /var/repos
$ git clone --bare /tmp/tstci
$ cd /var/repos/tstci.git
$ cd touch tstci-daemon-export-ok

Windows(Eclipse)からCentOS上のレポジトリをインポートする

Eclipseを起動後、Egitのプラグインをインストールしておく。
その後、「ファイル」→「インポート」
「Gitからプロジェクト」を選んで「次へ」
git1

「Clone URI」を選んで「次へ」
git2

以下の様に、設定して「次へ」。ホスト名と環境によって変化するので注意
無題

masterを選んで「次へ」
git4

任意の名称で「次へ」
git5

新規プロジェクトを選んで「完了」
git6

最後に「PHPプロジェクト」を選びgit用のプロジェクトがeclipse上に完成!

Windows(Eclipse)からコミット、プッシュしてみる

どこでも場所は構わないのでファイルを1つ作る。
git7

作成したファイル上で右クリック→「チーム」→「コミット」
任意でメッセージを記述。対象ファイルを選んでコミット。
git8

関連記事

コメント

カテゴリー

お問い合わせはコチラ!