Web hook pull Git Repo down to a web server for production without history or .git folder

Deploying with web hook

Place a file with the line below in your web root. Have the web hook on github or gitlab call the url i.e. www.example.com/webhook.php

This will update your web root (public_html , www) with the latest version of your code without the history and without .git folder.


`git archive –format=tar –remote=git@gitlab.example.com:user/repos-beta.git master | tar -xf -`



Alternate method 

Deploying a Git repository to a remote server

Git’s archive command is basically the equivalent of SVN’s export – it dumps a copy of the entire repository without any of the version control files, making it perfect for deploying to a testing or production server.

Using a combination of git archive, SSH, and Gzip; deploying a Git repository to a remote server can be done quickly and easily:

git archive --format=tar origin/master | gzip -9c | ssh user@yourserver.com "tar --directory=/var/www -xvzf -"

Let’s take a look at the different parts of that command.

This tells Git to combine all of the repository’s files into a single tarball file. The benefit of doing this is that a large single file can be transferred much quicker than thousands of smaller files.

If you are familiar with Git, you should recognise that these are the default names for a Git remote and branch. You should change these to match your remote/branch setup.

gzip -9c
The tarball created by git archive is piped into Gzip, which applies compression to reduce the size of the file. The 9 flag tells Gzip to use the best compression method, and the c flag makes Gzip write the compressed file to stdout. The reason we want Gzip to write to standard output is so that we can send the compressed repository straight to the remote server via SSH.

ssh user@yourserver.com “tar –directory=/var/www -xvzf -“
The Gzipped tarball is then piped through SSH to your remote server. The remote server runs tar --directory=/var/www -xvzf - which extracts the Gzipped tarball into the /var/www directory. Note that the hyphen (-) at the end of the tar command tells tar to receive data from a piped command instead of a file.



cyberduck and filezilla ssh works but sftp illegal packet length

 The number … represents the first four bytes read from the server. If your login scripts are printing words, this will be the first four characters cast into a number, and not an SFTP message at all.

To fix the problem find out what command in your login script prints text. Once you find it move the command to the proper interactive script, or remove it entirely. The scripts are usually hidden (their name starts with dot) and are located in your home directory on the server. Typically you will need to move the commands from .bashrc script to .bash_profile.

There are other possible sources of the message in addition to the profile script – some SSH servers print messages if they are unable to start the SFTP server, or encounter a fatal error. You should contact your server administrator. 


mv .bashrc .bash_profile

source .bash_profile

try reconnecting with sftp client


creds http://winscp.net/eng/docs/message_large_packet