Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#! /usr/bin/env bash
# Usage: git-io URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
URL="$1"
CODE="$2"
SHORT_URL=$(curl -si https://git.io -F "url=${URL}" ${CODE:+-F "code=${CODE}"} | grep 'Location:' | sed 's/Location: //')
echo "Copied URL to clipboard."
echo "${SHORT_URL}" | pbcopy
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.