以下の内容はhttps://www.rasukarusan.com/entry/2021/02/26/163608より取得しました。


今更ながらgit-ftp便利すぎた

f:id:rasukarusan:20210226164209p:plain
とりあえず必要なことをババっと書いておく

インストール

brew install git-ftp

もしくは、リポジトリにgit-ftpの実行ファイルがあるからcloneしてきて使ってもいい。

git clone https://github.com/git-ftp/git-ftp
cd git-ftp
./git-ftp

初期設定

git config git-ftp.url "ftp://FTPホスト/指定ディレクトリ"
git config git-ftp.user "FTPユーザー名"
git config git-ftp.password "FTPパスワード"
git config git-ftp.syncroot pushしたいディレクトリ

ignore設定

.git-ftp-ignoreに書き込んでいく。書き方は.gitignoreと同じ。

touch .git-ftp-ignore

サーバーにPUSH

git ftp init

初回のみinitが必要で、initをしたら自動的にpushされるので注意。
二度目以降はgit ftp pushでpushする。

git ftp push

staging, production環境で分けたい

git-ftp.<environment>で振り分け可能。

staging

git config git-ftp.stg.url "ftp://ステージングのFTPホスト/指定ディレクリ"
git config git-ftp.stg.user "ステージングのFTPユーザー"
git config git-ftp.stg.password "パスワード"
git config git-ftp.stg.syncroot pushしたいディレクトリ

production

git config git-ftp.prd.url "ftp://プロダクションのFTPホスト/指定ディレクリ"
git config git-ftp.prd.user "プロダクションのFTPユーザー"
git config git-ftp.prd.password "パスワード"
git config git-ftp.prd.syncroot pushしたいディレクトリ

確認

cat .git/config

staging, production環境で分けてPUSHする

-sで指定する

staging

git ftp init -s stg
git ftp push -s stg

production

git ftp init -s prd
git ftp push -s prd

ちなみに振り分け設定していない場合に、-sをつけずにinit等をしてもエラーとなる。

$ git ftp init
fatal: Remote host not set.

終わり

急遽Wordpressをすることになり、自前で用意したステージング用サーバーがFTPのみ利用可能で必要になった。
Wordpressのデプロイにはwordmoveが最適っぽいが、設定ファイルを書くのがだるすぎたので却下した。開発用サーバーとかはどうなってもいいから楽なやつがいい。




以上の内容はhttps://www.rasukarusan.com/entry/2021/02/26/163608より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14