user2359272
user2359272

Reputation: 33

Synchronize git repository with server without git

I am currently a newbie with git.

My idea is, that I am working with my local git repo and push this to a bare repo.

But then I want to publish the changes to a live site, which has no possibility to install git. So I am not able to do a pull on the live site from the bare repo. How would you sync the changes from a bare git repository to this live site?

Thank you very much for your ideas.

BR

Upvotes: 3

Views: 686

Answers (2)

kostix
kostix

Reputation: 55453

Another option is using git-ftp which might be especially suitable for website deployment as FTP is usually available.

Upvotes: 0

Ian Mariano
Ian Mariano

Reputation: 529

Since you can't install anything on the remote server, you would write a deployment script that would "publish" the code to the site using ssh (rsync), sftp, or other file transfer method. I would not include any login information in the script, rather require it as either a parameter to the script or an environment variable.

Here's a _simple_ example using bash:

#!/bin/bash

usage() {
    echo "deploy usage:
    echo "   deploy sshtarget # uses rsync"

    exit 1
}

if [ $# -eq 0 ]; then
    usage
fi

echo "Deploying to $1..."

rsync -e ssh -avh --progress --exclude .git* --exclude .giti* --exclude deploy * $1

exit 0

So this uses the user's current ssh identity as the basis for copying the files to the remote server and "sshtarget" would be the remote directory. For example if the deploy script was at the root of the source tree and so were the files you'd publish:

./deploy [email protected]:/var/www/folder

Again, a simple example.

Upvotes: 2

Related Questions