Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a project where I only have FTP control of the server. I am basically hand deploying changes from GIT commits to the server.

Is there any way to automate this (without writing the script myself, which I'm about to do), without being able to install git on the server?

share|improve this question
up vote 3 down vote accepted

I think what you need is git-ftp. I never tried it, anyway.

share|improve this answer
Thanks, David, that looks quite awesome. I'll check it out. – Dan Rosenstark Jul 14 '11 at 18:05
return if it fixed your problem – kokbira Jul 14 '11 at 18:17

While I was waiting for answers, I cooked this up. Though now I"ll have to check out git-ftp as David Costa suggests. This script doesn't actually do anything: it just gives you commands for your own FTPing.

#!/usr/bin/env ruby
if __FILE__ == $0
  puts "Pulls file list between two git commits and makes ftp commands"
  if ARGV.length != 2
    puts "Sorry, include two hashes as arguments separated by spaces"

  hash1 = ARGV[0]
  hash2 = ARGV[1]

  command = "git log #{hash1}..#{hash2} --name-status --pretty=\"%p\""

  results = `#{command}`
  results = results.to_a[2..-1].join

  lines = results.to_a
  lines.each do |line|
    modifyAddDelete = line[0..0]
    if (modifyAddDelete=="M" || modifyAddDelete=="A")
      command = "put"
    elsif (modifyAddDelete = "D")
      command = "delete"
    filename = line[2..1000]
    puts "#{command} #{filename}"


share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .