Resume git server management utils

This commit is contained in:
Nero 2023-01-31 14:41:02 +00:00
parent 5faa9e0cb9
commit aac13f9fc7
3 changed files with 0 additions and 54 deletions

View File

@ -1,26 +0,0 @@
#!/bin/sh
upstream="$1"
name="${upstream%/}"
name="${name##*/}"
name="${name%.git}"
repo="${HOME}/git/${name}.git"
# create as bare repo
git init --bare "$repo" || exit $?
touch "${repo}/git-daemon-export-ok"
(
cd "$repo"
git config remote.origin.url "$upstream"
# fetch heads and tags only
git config --replace-all remote.origin.fetch "+refs/heads/*:refs/heads/*"
git config --add remote.origin.fetch "+refs/tags/*:refs/tags/*"
# mark this remote to be fetched via update-git-mirrors
git config remote.origin.mirror true
git fetch -p origin
)
# suggest possible urls to use as remote
echo "$(id -un)@$(hostname -f):git/$name.git"
echo "git://$(hostname -f)/$(id -un)/$name.git"

View File

@ -1,14 +0,0 @@
#!/bin/sh
# i keep a tiny collection of mirrored repositories on some hosts
# this script updates them
for repo in $HOME/git/*.git; do
test -e "$repo" || continue
name="${repo%/}"
name="${name##*/}"
name="${name%.git}"
(
cd "$repo"
test "$(git config remote.origin.mirror)" = true || return
git fetch -p origin || echo "[exited with code $?]"
) 2>&1 | sed "s|^|$(printf "%16s: " "${name}")|"
done

View File

@ -1,14 +0,0 @@
#!/bin/sh
name=${PWD##*/}
name=${name%.git}
if test -e git-daemon-export-ok; then
for upstream in $(git config --get-all receive.mirror); do
url=$(printf "$upstream" "$name")
git push --mirror -f "${url}" &
done
fi
git update-server-info &
wait