You are not logged in.

#1 2010-07-13 01:06:04

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

git on ftp-server

Hey ho,

I've got some space on a ftp server and wanted to put some git repos on there. I tried mounting the ftp server via curlftpfs but that doesn't work as expected. So i came up with 2 small wrapper scripts. They are not really usable, because they're just a test if this idea would work as expected. Well, it works, but it's pretty slow and just supports the very basics of git.

ftpclone:

#!/bin/bash -


repo=$1
local_path="$PWD"
tmp_path="/tmp/${repo}-$RANDOM"
username=foobar
if [ "$2" == "" ]; then
    branch="master"
else
    branch=$2
fi

mkdir -p $tmp_path
cd $tmp_path
lftp -u $username -e "mirror $repo" ftp.fooserver.bar/gits
if [ -e "$local_path/$repo" ]; then
    cd $local_path/$repo
    git pull $tmp_path/$repo $branch
else
    cd $local_path
    git clone $tmp_path/$repo
fi

and ftppush:

#!/bin/bash -


repo=$1
tmp_path="/tmp/$repo-$RANDOM"
current=$PWD
username=foobar
if [ "$2" == "" ]; then
    branch="master"
else
    branch=$2
fi

if [ "$repo" == "" ]; then
    echo "Fail.. no repo"
    exit 1
fi

mkdir -p $tmp_path
cd $tmp_path
ftpclone $repo
cd $repo
git pull "$current/$repo" $branch
cd ..
lftp -u $username -e "mirror --reverse --delete --verbose $repo" ftp.fooserver.bar/gits

(NOTE: ftppush depends on ftpclone in $PATH.)
Does anyone of you know a better way to handle this problem, or does it worth it to invest more time into this?

greetings,
knopwob

Last edited by knopwob (2010-07-13 01:07:01)

Offline

#2 2010-07-14 20:10:44

IwfY
Member
Registered: 2009-04-24
Posts: 20

Re: git on ftp-server

I searched for something like this some time ago. Will give your scripts a try. Thanks.

Offline

Board footer

Powered by FluxBB