Skip to main content

git/_get_github_url

1#!/usr/bin/env bash
3set -o errexit
4set -o nounset
6# The remote URL will be something of the form
7#
8# git@github.com:alexwlchan/photo-reviewer.git
9#
10# The tr/awk gets everything after the colon
11REPO_NAME=$(
12 git remote get-url origin \
13 | tr ':' ' ' \
14 | awk '{print $2}' \
15 | sed "s/\.git//g"
18printf "https://github.com/$REPO_NAME"