-
-
Save jdraths/42da77fe7d98a8c4090efb2d76636ce5 to your computer and use it in GitHub Desktop.
Automator service to clone Git repos in Mac Finder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# https://github.com/alloy/terminal-notifier | |
# Once you install terminal-notifier, you should check the location and update the | |
# NOTIFIERAPP value below appropriately | |
# cd "$@" | |
# REPOPATH=`pbpaste` | |
# REPOFULL=$(basename "$REPOPATH") | |
# REPONAME="${REPOFULL%.*}" | |
# git pull $REPOPATH | |
git pull | |
# NOTIFIERAPP="/usr/local/bin/terminal-notifier" | |
# if [ -e $NOTIFIERAPP ] | |
# then | |
# $NOTIFIERAPP -title "Git Pull Completed" -message "Git repo '$REPONAME' has been pulled" | |
# fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment