logo

install and configure git-ftp on windows OS with easy step by step guide

install git-ftp on window

Here in this article we will learn how to install and configure git-ftp on our windows based local system with easy step by step method. Before starting I would like to tell you what is git-ftp?

What is GIT-FTP?

It uploads files to server in the same way GIT works, it creates a log file on your server and keeps track of commits or file you have changed, on upload it uses GIT to determine which files are changed or newly created and uploads only those files. it provides us the following ease and advantages over FTP clients like filezilla

  1. We do not need to select which files to upload
  2. Saves bandwidth of uploading unnecessary files
  3. No need to switch to FTP Client
  4. Reduces developer time consumption
  5. We can revert to any previous version easily
  6. Can easily merge files edited by multiple developers

How to install git-ftp?

Step 1

To start these steps you need GIT installed, if not already installed download it from git-scm.com/downloads and install.

Step 2

After installing GIT, got to its program files, for me it is located at

where ever this folder is, just note the path we will have to use it in the following steps

Step 3

Goto start menu type and search git bash right click on it and select Run as Administrator
type the following commands line by line and enter

GIT-FTP installed, Now lets see how to configure it with our repository

How to Configure git-ftp?

Step 1

Create local git repository, it will work even if not linked to online git or bitbucket repository.

How to create local repository

  1. Open CMD
  2. goto your project directory eg (c:/wamp/www/myproject)
  3. write git init and hit enter

it will create .git hidden folder at your project folder

Step 2

To save ftp credentials open CMD, goto root of your project folder eg (c:/wamp/www/myproject)
type the following commands replacing ftp_host, username and password with your ftp credentials

we are all done to configure git-ftp for our project, now let see how can we upload files.

Testing git-ftp upload

As I have mentioned above that git-ftp works with GIT and it creates a log file at your server. that log file is created for the first time once, so we have a bit different upload command for first time.

As git-ftp uses GIT so we have to commit our changes before uploading

Open CMD and goto your project directory eg (c:/wamp/www/myproject)

it will upload all files and folders of your project
check your website all file will be uploaded

Now on-wards as it has created log file so we have to upload only those file which are changed so we have to write git ftp push instead of git ftp init let try
make some changes in your code

This time with push it will upload only those files which are changed, it will be displaying which files are uploaded.
check your website new changes will be uploaded

Upload (git ftp push) needs a commit before it, we can upload after each commit or after many commits when ever we want.
git ftp push only upload your files to server via ftp not to repository, if you want to upload to repository you have to run git push
If you want to prevent some files or folders from uploading create a .gitignore file and mention path of that files and folders relative to root of your project or google for it.

Shifting from other FTP Clients to Git-FTP

This section of lesson will be handy and helpfull in case you have already uploaded project to server and configuring git ftp in middle and do not want to re-upload all files.

As we learnt above that we will have to run git ftp init for the first time and it will upload all files (except those mentioned in .gitignore)
But what if we have already uploaded our files to server via some other FTP client and this time we do not want to re-upload all files with git ftp init?
And we will also be not able to directly run git ftp push as there is no hash uploaded at server to track the changes.
here is the solution, instead of running git ftp init run git ftp catchup

git ftp catchup

git ftp catchup creates log file at server to save hash for tracking changes and do not upload any file, after running this command we will be able to make changes and run git ftp push to upload only changed files

Hope this helped you, I encourage you to please write your valuable views and experiences about this topic in comments to share with other developers and friends.

Comments

  • Write a Reply or Comment

    Your email address will not be published. Required fields are marked *