Skip to content

Instantly share code, notes, and snippets.

@koenmetsu
Last active August 29, 2015 14:21
Show Gist options
  • Save koenmetsu/c2c4f92c514b9bbcd84c to your computer and use it in GitHub Desktop.
Save koenmetsu/c2c4f92c514b9bbcd84c to your computer and use it in GitHub Desktop.
Bash function: Gitlab replace https with ssh protocol
# Usage:
# fetch git fetch https://git/someuser/somerepo.git somebranch
# will execute instead:
# git fetch git@git:someuser/somerepo.git somebranch
function fetch() {
local old_url="$*"
new_url=$(sed 's#https://git/#git@git:#g' <<< $old_url)
$new_url | sh
}
export -f fetch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment