Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Automator service to clone Git repos in Mac Finder
# Use this to quickly create a git repo in a Mac Finder folder
# You need to create an Automator service:
# - Open Automator, choose to create a new Service
# - At the top, select Service receives selected "Folders" in "Finder"
# - From the list at the left, choose Library/Utilities, then drag the
# Run Shell Script action to the workarea
# - Paste the script below into the script area
# - Make sure you set the 'Pass input:' selection to "as arguments"
# - Save the service with an easy to find name, I used "Git Clone Here"
# To use:
# - Copy the repo path to your clipboard, like from a Github repo page
# - Right click on the folder where you want to store the repo
# - Choose Service from the menu, then "Git Clone Here" to clone the repo into the folder
# - It will notify you when done if you have the terminal-notifier app installed
# Once you install terminal-notifier, you should check the location and update the
# NOTIFIERAPP value below appropriately
cd "$@"
REPOFULL=$(basename "$REPOPATH")
git clone $REPOPATH
if [ -e $NOTIFIERAPP ]
$NOTIFIERAPP -title "Git Clone Completed" -message "Git repo '$REPONAME' has been cloned"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.