Upload Files to your Web Server using Git

If you upload files frequently to your web server, you’ll know how much of a pain it can be to upload only the files needed. I had resorted to another method of zipping everything on my computer, upload to the server, then extract from there replacing all my files. Butย as a lazy guy, this was simply unacceptable! And guess what? I found the perfect solution.

git-ftp
git-ftp (GitHub repo)
So, i install git-ftp on my Kubuntu.
You need to have an ftp account created on your web server.
Initially you need to push using this command
git ftp init -u <user> -p - ftp://host.example.com/public_html
Everytime your mates or yourself commit/push to your remote ย git repository, you run these 2 lines and the changes get reflected on your live server in less than 2 mins. ๐Ÿ˜€
git pull origin master
git ftp push --user <user> --passwd <password> ftp://host.example.com/public_html
It uploads only files that has been changed. It’s almost like magic. LOL ๐Ÿ˜›
You can even create a shell script for these 2 lines if you’re like lazy to the extreme. But i just press the up button in my terminal and the codes are already here. ๐Ÿ˜‰

3 thoughts on “Upload Files to your Web Server using Git

  1. Hello. The git method is a nice one but you could still use rsync to just synchronize incremental changes. You don’t need to upload whole stuffs if you haven’t changed them all.

  2. Didn’t know about rsync. But seems like it’s too complicated for me. git ftp is doing the job more than perfectly for me ๐Ÿ™‚

Leave a Reply

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