Working with Git-ftp

I had a problem while working with my last project that, i hosting the website at a low costing company, and they don’t provide ssh or git on their servers .

Working with Git-ftp

i searched github and i found a repository called git-ftp, and this solve the problem in a nice way, let’s start wth working with a new project in our www directory

New project to start with

first we have to initialize git, using the following command
`git init`
the last command will install `.git` directory

Change the directory to .git directory and open the config file `nano .git/config` , then start to add the ftp login for our servers .

add the following line ( please note the comments )

        user = username  # username for the FTP 
        url = # the url for the destination directory
        password = PASSWORD  # the password for the FTP 

Then the next step to add the files need to be tracked, in the most cases you will need to track all the files with the following command .

git add * 

then you have to commit the changes, with the following command

git commit -a -m "this the message for the commit" 

Note that you will need to use those parameters -a , -m

then with the final step to upload the changed file to the hosting, with the following command

git ftp push 

Important notes:

  • Using the command git ftp push will upload all the files to the server, but in some cases i upload the files already with any other FTP client, then what i have to upload only is the .git-ftp.log file, in this case use the catchup command
  • it’s important to double check the destination of the files to not over write the added files, you can find them in .git/config file


Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: