Skip to content

Instantly share code, notes, and snippets.

@Tantas
Created August 18, 2014 19:31
Show Gist options
  • Save Tantas/cd77cec4b6389e99dd92 to your computer and use it in GitHub Desktop.
Save Tantas/cd77cec4b6389e99dd92 to your computer and use it in GitHub Desktop.
List and clone gitolite repos using ssh keys
#!/bin/sh
# List and clone gitolite repos using ssh keys
# Note: 'privategit' is a host found in ~/.ssh/config
# List the available repositories if no argument
if [[ "$#" -ne 1 ]]; then
echo "Provide the name of the project to clone"
echo "Available projects are:"
ssh privategit info 2>/dev/null | tail -n +3 | awk '{ print $3 }'
exit 0
fi
# Clone the repository
git clone "ssh://privategit/$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment