Advertisements

How to Install Git FTP

Advertisements

Here we will learn how to install git ftp to speedup our deployment. The advantage of the git ftp is we can maintain our project in efficient way. We can keep backup our code at git repository and we can find only the changed code and deploy the files to our server. When setup is done, we can upload files to our server with 2 lines of command.

How to Install Git FTP

First install git cmd here.

Now search gitbash in searchbar and Open GitBash and right click and select run as administrator.

First enter the below command to check which git file we need to install git-ftp

If the response is /bin/git.

cd C:\Program Files\Git
git clone https://github.com/git-ftp/git-ftp git-ftp.git
cd git-ftp.git && chmod +x git-ftp
cp C:\Program Files\Git\git-ftp.git\git-ftp C:\Program Files\Git\bin\git-ftp

If the response is /mingw64/bin/git.

cd C:\Program Files\Git\mingw64
git clone https://github.com/git-ftp/git-ftp git-ftp.git
cd git-ftp.git && chmod +x git-ftp
cp C:\Program Files\Git\mingw64\git-ftp.git\git-ftp C:\Program Files\Git\mingw64\bin\git-ftp

Now we will configure the git ftp.

Configure Git-ftp

Goto your project folder and run below these commands

git config git-ftp.url ftp://ftp_host/public_html/
git config git-ftp.user ftp_username
git config git-ftp.password ftp_password

ftp_host is hostname like yourwebsite.com, ftp_username and ftp_password you can get these details from hosting provider cpanel, or any other web panel.

Pushing code to server using git ftp

Goto your project folder.

If pushing For first time use these commands.

git add .

git commit -m "my changes description"

git ftp init

git ftp push

If already pushed first time and uploading new changes use these commands.

git add .

git commit -m "my changes description"

git ftp push

Read also list of github commands for pushing and commit code.