You are not logged in.

#1 2010-02-10 09:42:23

JezdziecBezNicka
Member
From: Cracow, Poland
Registered: 2009-12-03
Posts: 89

sharegit - git-daemon launcher

I needed a simple way to share my git repo, so that others can pull from me over lan, and here it is:
I am not good at bash so suggestions and corrections are more than welcome.

usage:
just run sharegit somewhere within your repository directory

#!/bin/bash
ORIGDIR=$(pwd)
while [[ ! -d ".git" && $(pwd) != "/" ]]; do
    cd ..
done

PGIT=$(pwd)
NAME=$(basename `pwd`)

cd /tmp

if [[ -a "$NAME.git" ]]; then
    rm $NAME.git
fi
ln -s $PGIT/.git $NAME.git

COND=$?

cd $ORIGDIR
if [ $COND -eq 0 ]; then
    echo "You can now pull from git://127.0.0.1/$NAME.git"
    echo '^C to stop the git daemon'
    git daemon --base-path="/tmp/" --reuseaddr --export-all
fi

edit: updated the script

Last edited by JezdziecBezNicka (2010-02-10 14:37:44)


This is my signature. If you want to read it, first you need to agree to the EULA.

Offline

Board footer

Powered by FluxBB