Upload files via Git FTP

2020-06-24 hit count image

let's see how to use Git FTP to upload files via FTP.

Outline

When I developed a toy project, I needed to deploy the backend of the service via FTP.

We can use Git FTP to upload files managed by Git via FTP.

Install Git FTP

  • macOS

Execute the command below to install Git FTP.

brew install git
brew install brotli
brew install git-ftp
  • Others

If you use not macOS, see the link below to insall Git FTP.

How to use

Setup

To use Git FTP, execute the command below to configure FTP.

git config git-ftp.url "ftp://example.com/ftp/server/address"
git config git-ftp.user "user-id"
git config git-ftp.password "user-password"

Init

If you haven’t uploaded files on the server, execute the command below to init and upload all files.

git ftp init

Catchup

If you have uploaded files on the server, execute the command below to sync the files.

git ftp catchup

Push

We’ve configure all settings. After developing, normally, we can commit them via Git like below.

# Modfiy some source codes
git add .
git commit -m 'Fix some bugs'
git push origin master

And then, To upload files via FTP, execute the command below.

git ftp push

Completed

We’ve seen how to use Git FTP. Recently, we don’t upload and deploy via FTP, so, this blog post is not useful. However, For the people who use the special environment like me, I think this is great and useful!

Posts