Skip to content

Instantly share code, notes, and snippets.

@carlolars
Created April 22, 2019 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlolars/78548f1dfd4c8b977670ac40bce4a283 to your computer and use it in GitHub Desktop.
Save carlolars/78548f1dfd4c8b977670ac40bce4a283 to your computer and use it in GitHub Desktop.
Yet another git-serve alias.
[alias]
    serve = "!f(){ printf \"Starting git-daemon for $(pwd) @ 'git://$(hostname)/$(basename $(pwd))'.\nExample: git clone git://$(hostname)/$(basename $(pwd)) [<directory>]\n\"; git daemon --base-path=.. --reuseaddr --informative-errors --verbose --export-all ../$(basename $(pwd)) ; }; f"

Most serve aliases I've seen exports the current directory using itself as base path, which anonymizes the actual repository beeing shared (git://<addr>) unless sharing the parent directory which cause all repositories there to become exported.

This alias exports the current directory using the parent directory as base so the repository URL will be like
git://<addr>/my-repo.
It also prints the URL that can be used to access the exported repository when the daemon starts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment