GIT and SFTP

Lots of complains adopting git, is not to have a server that support ssh let alone git. A nice post by jefferey way in nettuts suggests deployhq. Thats a nice service with nice GUI . But i was looking for a free solution and found one under a comment in that post.

https://github.com/git-ftp/git-ftp

This not only provides FTP protocol also support SFTP. Here are the steps that i took in my mac os environment.

  • I used brew to install git-ftp:
    $brew install git-ftp
  • This relies on libcurl so next thing i had to install curl with ssh support :
    $brew install curl –with-ssh
  • Brew does not overrides default curl library that comes with osx,  so i had to replace that using
    $sudo rm /usr/bin/curl
    $sudo ln -s /usr/local/Cellar/curl/7.35.0/bin/curl /usr/bin/curl
  • Now I cd into my repository and run :
    $git ftp init -u <username> -p – sftp://<host_url>/<path>
  • It syncs my current HEAD branch into the server and keeps track of last commit. So after making few other commits, i am ready to push latest changes to server. By running:
    $git ftp push -u <username> -p – sftp://<host_url>/<path>

I hope from now on you will use GIT for server deployment.

NOTE: git-ftp stores commit log in a file .git-ftp.log file. If any mishaps happens or you want to re-sync everything. Remove that file and you are good to go.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s