So you’ve read about this Git thing on Twitter or maybe listened to an annoying colleague who keeps talking about it. Perhaps you’ve come to the conclusion that Git is something good and you should probably use it.
There is one problem though. You got Git installed on your local machine, but you are stuck on a shared hosting service that kinda sucks. You have no possibility to use Git for deployment like the
real professionals seams to do. Until now!
I’ve tried a “Git powered FTP client written as a shell script” that seams to work quite well.
First, you need to have Homebrew (and Git of course) installed to get set up on Mac OS. When you got that installed you should be able to run
brew from the command line.
These are the commands you have to execute in order to install git-ftp:
brew install grep
brew install git
brew install curl --with-ssl --with-ssh
brew install git-ftp
The official guide for installation is available here.
Now it’s time to try it out!
Create a new directory and cd into it.
mkdir test && cd $_
Create a new file and write something random in it.
Create a new Git repository and commit the file.
git add index.html
git commit -m 'First commit'
Okey, now it’s time to push the file to the server.
git ftp init -u exampleusername.com -p ftp://ftp.exampleserver.com/optionalsubdirectory
Hit return and write the password for your server. index.html should have been uploaded now if everything went well. Congratulations!
Make a random change in index.html and make a new commit.
git add index.html
git commit -m 'Second commit'
But wait, you don’t wanna write your credentials every time you’re going to push changes to the server. Instead you can save them to the config file:
git config git-ftp.user exampleusername.com git config git-ftp.url ftp://ftp.exampleserver.com/optionalsubdirectory
git config git-ftp.password qwerty123
And you’re ready to push the file to the server.
git ftp push
Celebrate! You are now a real developer.