DEV Community

Cover image for Installing Git FTP
Chetan Rohilla
Chetan Rohilla

Posted on • Updated on • Originally published at w3courses.org

Installing Git FTP

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

git add .
git commit -m "my changes description"
git ftp push
Enter fullscreen mode Exit fullscreen mode

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


Please like share and give positive feedback to motivate me to write more.

For more tutorials visit my website.

Thanks:)
Happy Coding:)

Top comments (1)

Collapse
 
_echo3d_ profile image
echo3D

Interesting post!