Git FTP Case Study on Windows

This post is for those who have already mastered a bit of GIT, and want their life to become even simpler, and their performance higher! Those. do a push right away to an FTP server that does not have SSH access.

To work with the console, I used Git Bash.

I divided the post into several stages:
  1. Install Git-Ftp
  2. Checking Installed Git-Ftp
  3. Repository setup
  4. Usage, upload to FTP server

1. Install Git-Ftp:


$ git clone https://github.com/git-ftp/git-ftp
$ cd git-ftp
$ chmod +x git-ftp
$ cp ~/git-ftp/git-ftp /bin/git-ftp


2. Checking the installed Git-Ftp:


$ cd ~
$ which git-ftp
/bin/git-ftp
$ git-ftp --help

If everything was done without errors, then the installation went as planned.

3. Configuring the repository:


Application to the project:
$ cd /c/OpenServer/domains/site-name
$ notepad .git/config


Add the following to the opened config:
[git-ftp "test"]
     user = ваш_ftp_пользователь
     url = 255.165.35.35/www/site-name.com
     password = ваш_ftp_пароль

url is the IP address / path to the repository on the ftp server
test - the name of the config that will indicate which ftp server the updates will be downloaded to. You can specify several.

It is not necessary to put a mark that fresh updates have already been downloaded to the server. In this case, git-ftp will only update newly modified files.
$ git ftp -s test catchup


4. Use, upload to FTP server:


$ git add .
$ git commit -m "Commit name"
$ git ftp -s test push

test is the name of the ftp config that we specified in the Git settings.

That’s basically it. When editing files, repeat the procedure from step 4 to update the files on the server.

Also popular now: