Enable SFTP in cURL
Curl
is the most well-known command-line utility for transferring data over the network (e.g. downloading a file over HTTP).
On SourceLair you can use curl
out of the box to download and upload files over HTTP. If you would like to use it over the SFTP protocol instead, there are a few steps you have to take first.
Enable SFTP support in cURL
To enable SFTP support in curl
, run the following commands in your terminal:
# Step 0: Install Linuxbrew, if not already installed
if ! [ -x "$(command -v brew)" ]; then
echo 'Installing Linuxbrew.'
echo -e 'export PATH="$HOME/.linuxbrew/bin:$PATH"\nexport MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"\nexport INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"' > ~/.bashrc && source ~/.bashrc
ruby -e "$(wget -O- https://raw.github.com/Homebrew/linuxbrew/go/install)"
brew update
brew doctor
fi
# Step 1: Install libssh2
brew install libssh2
# Step 2: Install cURL with libssh2 support (consequently with SFTP support as well)
brew install curl --with-libssh2
💡 Tip: Use this hack to set up secure Git FTP deployments over SFTP!
Is there any other hack you would like to see here? Request a hack.