You are not logged in.
Pages: 1
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
I searched for something like this some time ago. Will give your scripts a try. Thanks.
Offline
Pages: 1