Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created March 15, 2012 13:16
Show Gist options
  • Save metaskills/2044146 to your computer and use it in GitHub Desktop.
Save metaskills/2044146 to your computer and use it in GitHub Desktop.
A Git.io URL Shortener Console Function
# If you are not on a Mac and do not want the URL
# copied to the clipboard, remove the pbcopy command.
function gitio () {
local url=$(curl -s -i http://git.io -F "url=$1" | grep "Location: " | cut -d" " -f2 | tr "" "\n")
echo "$url" | pbcopy
echo $url
}
@metaskills
Copy link
Author

Usage is simple. The URL will be copied to your clipboard and echoed.

$ gitio https://gist.github.com/2044146

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