LoginSignup
27
27

More than 5 years have passed since last update.

(2)EC2+gitリモートサーバ構築#2|EC2でgit+RonR+unicorn+nginx+capistrano+Jenkins

Last updated at Posted at 2013-03-02

その2|gitリモートサーバの構築

1.gitインストール|EC2-User

1) ec2-userでログイン

2) yumでgitインストール

sudo yum -y install git

3)リポジトリディレクトリ作成
このディレクトリ以下にリポジトリを作成していく方針。

sudo su - gituser
mkdir ~/repos

2.テストしてみる

リモートリポジトリを作成し、ローカルからpushしてみる。

1)ec2-userでログイン

2)gituserでリポジトリを作成

sudo su - gituser
cd ~/repos
mkdir test.git
cd test.git
git --bare init

3)ローカルリポジトリの作成|ローカルマシン
gitserverは.ssh/configに登録済み。
参考:前回の記事

mkdir ~/test
cd ~/test
git init
git remote add origin gitserver:/home/gituser/repos/test.git

4)ローカルリポジトリでファイル作成しコミットしpush

cd ~/test
echo "this is my first file." > test.txt
git add .
git commit -m "first commit"
git push origin master

5)別のローカルディレクトリにpullしてみる。

mkdir ~/test2
cd ~/test2
git init
git remote add origin gitserver:/home/gituser/repos/test.git
git pull origin master

test.txtが存在していればOK

27
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
27