まず、deploy のディレクトリに移動します。
cap install でcapistanoのファイルをインストールします
[vagrant@localhost deploy]$ cap install
mkdir -p config/deploy
create config/deploy.rb
create config/deploy/staging.rb
create config/deploy/production.rb
mkdir -p lib/capistrano/tasks
create Capfile



# config valid for current version and patch releases of Capistrano
lock "~> 3.11.0"

set :application, "my_app_name"
set :repo_url, ""

# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp

# Default deploy_to directory is /var/www/my_app_name
# set :deploy_to, "/var/www/my_app_name"

# Default value for :format is :airbrussh.
# set :format, :airbrussh

# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto

# Default value for :pty is false
# set :pty, true

# Default value for :linked_files is []
# append :linked_files, "config/database.yml"

# Default value for linked_dirs is []
# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for local_user is ENV['USER']
# set :local_user, -> { `git config`.chomp }

# Default value for keep_releases is 5
# set :keep_releases, 5

# Uncomment the following to require manually verifying the host key before first deploy.
# set :ssh_options, verify_host_key: :secure

set:application, set :repo_urlでgitのレポジトリを書く


1. rubyが入っているかバージョン確認

[vagrant@localhost ~]$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

2. 続いてcapistranoが入っているか確認

[vagrant@localhost ~]$ cap --version
-bash: cap: コマンドが見つかりません

3. Capistranoをinstall
gem install capistrano とします。
[vagrant@localhost deploy]$ gem install capistrano
Fetching: net-ssh-5.0.2.gem (100%)
Successfully installed net-ssh-5.0.2
Fetching: net-scp-1.2.1.gem (100%)
Successfully installed net-scp-1.2.1
Fetching: sshkit-1.18.0.gem (100%)
Successfully installed sshkit-1.18.0
Fetching: airbrussh-1.3.1.gem (100%)
Successfully installed airbrussh-1.3.1
Fetching: concurrent-ruby-1.1.4.gem (100%)
Successfully installed concurrent-ruby-1.1.4
Fetching: i18n-1.2.0.gem (100%)

HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.

Please check your Rails app for ‘config.i18n.fallbacks = true’.
If you’re using I18n 1.1.x and Rails (< 6.0), this should be 'config.i18n.fallbacks = [I18n.default_locale]'. If not, fallbacks will be broken in your app by I18n 1.1.x. For more info see: Successfully installed i18n-1.2.0 Fetching: capistrano-3.11.0.gem (100%) Successfully installed capistrano-3.11.0 Parsing documentation for net-ssh-5.0.2 Installing ri documentation for net-ssh-5.0.2 Parsing documentation for net-scp-1.2.1 Installing ri documentation for net-scp-1.2.1 Parsing documentation for sshkit-1.18.0 Installing ri documentation for sshkit-1.18.0 Parsing documentation for airbrussh-1.3.1 Installing ri documentation for airbrussh-1.3.1 Parsing documentation for concurrent-ruby-1.1.4 Installing ri documentation for concurrent-ruby-1.1.4 Parsing documentation for i18n-1.2.0 Installing ri documentation for i18n-1.2.0 Parsing documentation for capistrano-3.11.0 Installing ri documentation for capistrano-3.11.0 Done installing documentation for net-ssh, net-scp, sshkit, airbrussh, concurrent-ruby, i18n, capistrano after 21 seconds 7 gems installed
4. Capistranoのバージョン確認
[vagrant@localhost deploy]$ cap –version
Capistrano Version: 3.11.0 (Rake Version: 12.3.2)



1. githubでissueを発行
2. issueの番号でブランチを切る
3. 開発
4. commit, push
5. プルリク
6. 配置

まず前提としてGithubもしくはGithub Enterpriseのアカウントがあることが必要になります。ない場合は、sign upしましょう。

1. githubでissueを発行
Githubにログインし、submit new issueでissueを発行します。


2. issueの番号でブランチを切る
clone or downloadからgit cloneします。


// git cloneする
[vagrant@localhost sample]$ git clone
Initialized empty Git repository in /home/vagrant/local/sample/bengoshi_chat/.git/
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 53 (delta 0), reused 2 (delta 0), pack-reused 50
Unpacking objects: 100% (53/53), done.

// cloneされたかフォルダを確認
[vagrant@localhost sample]$ ls

// ディレクトリに移動
[vagrant@localhost sample]$ cd bengoshi_chat
[vagrant@localhost bengoshi_chat]$ ls  config  lib  node  public_html

// ブランチを確認
[vagrant@localhost bengoshi_chat]$ git branch
* chat


gitで開発していく場合には、git cloneしたブランチではなく、作業用ブランチを作成して作業していきます。それを「ブランチを切る」と言います。
gitのブランチを作成するには git branch hogehoge と打ちます。

[vagrant@localhost bengoshi_chat]$ git branch
* chat
// branchを切ります
[vagrant@localhost bengoshi_chat]$ git branch newbranch
// branchを確認
[vagrant@localhost bengoshi_chat]$ git branch
* chat


// newbranchに切り替えます
[vagrant@localhost bengoshi_chat]$ git checkout newbranch
Switched to branch 'newbranch'
// 確認すると、newbranchになっているのがわかります
[vagrant@localhost bengoshi_chat]$ git branch
* newbranch



git add してstatusを見ると、状態がわかります。

// git add . とします。
[vagrant@localhost bengoshi_chat]$ git add .
// statusを確認すると、どのブランチ、ファイルか表示されます。
[vagrant@localhost bengoshi_chat]$ git status
# On branch newbranch
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#       modified:   public_html/index.php


[vagrant@localhost bengoshi_chat]$ git commit -m "text modify"
[newbranch f7b8b29] text modify
 Committer: vagrant 
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global "Your Name"
    git config --global

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

    git commit --amend --author='Your Name '

 1 files changed, 1 insertions(+), 1 deletions(-)

// pushします。
[vagrant@localhost bengoshi_chat]$ git push origin newbranch
error: The requested URL returned error: 403 Forbidden while accessing

fatal: HTTP request failed