Skip to content

Instantly share code, notes, and snippets.

@arf20
Created May 3, 2024 11:41
Show Gist options
  • Save arf20/e3cc67b5de04331d9e8598163737b847 to your computer and use it in GitHub Desktop.
Save arf20/e3cc67b5de04331d9e8598163737b847 to your computer and use it in GitHub Desktop.
Create bare git repo for git server with nginx and git daemon
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "usage: $0 <repo path>"
exit 0
fi
cd /srv/git
mkdir $1
cd $1
git init . --bare --shared
git update-server-info
cat <<EOF >> config
[http]
receivepack = true
EOF
git config --bool core.bare true
touch git-daemon-export-ok
chown -R www-data:www-data .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment